Microsoft Dynamics AX API -Part 1 "Creating Jobs"

From: http://blog.ak-home.net/CategoryView,category,Dynamics%2BAx%2cProgrammierung%2cAPI.aspx

 

An order in Microsoft Dynamics AX is a record in the table "SalesTable"(order header), if the contract contains an articel, a record exists in table "SalesLine". In addition, depending on the data of the contract (e.g. One time customer: Yes/No, inter company: Yes/no, etc.) additional records will exist in other tables.

 

The logic of creation of individual records of the various tables is displayed in Microsoft Dynamics AX through classes "SalesTableType", "SalesLineType" and their derived classes. These classes control the behavior of creating, modifing and deletion of a job.

 

 

These classes are called from overridden methods of the tables "SalesTable" and "SalesLine". For example, method "Insert" of table "SalesTable" which call the "SalesTableType". Depending on the type of the order, specified object is created ("SalesTableType_Sales", "SalesTableType_ItemReq", etc.).

 

Other methods like "update", "delete", "initValue", "validateField" are overwrote in the same way.

 

It will be clear if you look into methods of table "SalesTable" and "SalesLine".

 

Thus, creating a new order is quite easy because the entire business logic behind an order is automatically callled.

 

To create a new order:

1. A new reference number of the number sequence can be drawn.

2. The method "initValue" of table "SalesOrder" must be called

3. The customer must be assigned.

4. The method "initFromCustAccount" of table “SalesTable" must be called.

5. The method "insert" of table "SalesTable" must be called.

 

To create sales line, just call method "CreateLine" of table "SalesLine" with the prior definition of the order number("SalesLine.SalesId") and article("SalesLine.ItemId").

 

For example:

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值