For this demonstration, I use AIF service to create Sales order with SalesSalesOrderService and I gonna consume AIF using C#.NET.
Normally, in consume service application we handle return value by using EntityKeyList, EntityKey, KeyData.Value. And for Sales Order It will return Created SalesID.
Let’s take a look on AxdSalesOrder class. More about Axd class please prefer this.
Then go to createList method, this method will handle response value
So, how about customer wants another meaning value beside SalesID likes InventTransId information in SalesLine table or another tables base on your requirement. To do that, we need to customize this method.
How to do
I will use Map and MapEnumerator classes (Please refer MSDN to understand these class), this is steps:
We get the SalesId from the original entityKeyList and add into Map.
add Map to MapEnumerator.
Use SalesId to find the sales line. (mapEnumerator.currentValue() can get current SalesID).
Create a new entityKey and insert the sales line information to this entityKey.
add back entityKey to entityKeyList
From here in entityKeyList will store information of SalesID and List fields of SalesLine table.
Here is the code for createList method, beside SalesId I will try to get InventTransId in SalesLine Table
Code in C#.NET to get list key
Here is what we got
Just remember this one just for AIF Document Standard, for AIF custom service we do another way I will so in next post.
Main requirements is Using batch to find and block vendor base on last transaction condition and notify for them by emails.
Set up E-mail parameters
For set up email, we need Go to AX System administrator > Setup > E-mail parameters
Vendor emails locate on LogisticsElectronicAddress.Locator, partyTable.PrimaryContactEmail, partyLocation.Location, please take a look on this job to find how to update Vendor emails and you also could see the relations more clearly.
Main logic here is find Vend accounts are not exist in VendTrans table with condition endTrans.TransDate >= beginDate, and beginDate count from today systemDateGet().
Get the date before 6 months from today
Initializes a new instance of the Batch class.
Gets description of the dialog.
Find the vendor without transaction and disable, then send email to vendor
Provides an enter point for the Batch class.
From here you can run class and set up recurrence for batch job.
There is a maximum of one Primary Key per table, whereas a table can have several alternate keys. The primary key is usually the type of key that other tables, called child tables, refer to when a foreign key field in those other tables need a relational identifier.
For new tables the default is a primary key based on the RecId field , incremented number or a completely meaningless number that is generated by the system surrogate key.
Alternate key can be chosen as the Replacement Key of a table that can display on forms instead of a meaningless numeric primary key value. Each table can have a maximum of one replacement key.
Natural key has meaning to people. Most replacement keys are natural keys.
In Dynamics AX, there is a class called SysQueryRangeUtil that can be utilized in both query ranges and table filters. Using methods from this class allow you to be very precise about what dates you want to use in reports or for filtering your data.
Let’s say you have a report that you always want to run to see orders with shipping dates of the next day. It is possible to do so by using one of the methods from the SysQueryRangeUtil. The use of the letter ‘t’ will work for today’s date, but when you try to add days to it, it doesn’t work in reports. Instead, I will use the currentdate() method and add 1 to it.
All methods & expressions must be surrounded by parentheses as shown below.
Filtering the requested ship dates in an AX query for tomorrow (current day() + 1)
On any form with a grid, you filter your data by pressing Ctrl+G.
If I were to want to see open customer invoices from the last 90 days, I would filter my open customer invoices form and use the method (dayRange(-90,0)). The first number represents how many months backward from this month, and the second represents how many months forward. The same sorts of things can be done for the monthRange(), yearRange(), and dateRange() methods. The best part about this is that you can of course save these filters to create views that you might use on a daily basis.
If you are creating your query ranges in code, these methods can also be utilized whenever you are setting them. Definitely be sure to check out the SysQueryRangeUtil class as there are many more methods to use.