11.05.2009, 19:05 | #1 |
Участник
|
axStart: Updating records and calling super
Источник: http://axstart.spaces.live.com/Blog/...C0A0!549.entry
============== Last week I was programming x++. I had to create the following code. Before a record in AX gets updated an external application gets started. This external application is able to do additional update on the same record in AX by using AIF. As the performance of the external route is slow, an additional check is needed to start this process only if needed. So what do we have? A. Do I need to compare this with this.orig() before or after super? B. Do I need to call this external application before or after super? If we call the external application before super, AX will complain that another user has updated the record. So we have to do it after super. Fine, but what happens…. After super the original record gets equal to the current record. Ouch so the difference between the record and the original record only exists before super. The solution is to make a local buffer variable in the update method that references the original record before calling super. This buffer will still be used after calling super. Example: void update() { CustTable ctBuffer = this.orig(); Super(); If(this.name != ctBuffer.name) //call external application } Источник: http://axstart.spaces.live.com/Blog/...C0A0!549.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|