How to tell when the status of a salesorder has changed?

I’m trying to run some code whenever the status of a sales order gets to “delivered”, but I’m having trouble telling when that happens.

I had code in the ModifiedField method, but it doesn’t run because SalesTableType/SalesFormLetter calls SalesTable.doUpdate, which seems to cause this method to be skipped.

I want to monitor when it’s invoiced as well. Also when purchase orders are “received” and “invoiced”…

Any Ideas?

Hi Alex,

Put you code in datasource active method.

if(datasource.field == documentstatus::delivered)

{

// code

}

I hope it fulfill your requirements.

Thanks,

Saju.K.

Putting the code in active method may not be accurate.

Active method will be called every time a record get activated-

Try to put your code in SalesFormLetter_PackingSlip. Debugging will help you in placing the code at right place.

@Kranthi,

This is what I was thinking. The reason I wanted it table level is I might be automatically packing slip/invoicing salesorders and purchaseorders, and it looks like I’m going to have to have code in the SalesFormLetter_packingSlip, SalesFormLetter_Invoice, PurchFormLetter_packingSlip, PurchFormLetter_Invoice. It would have been nice to just have it in one spot somehow.

I’m trying to duplicate intercompany functionality between two dynamics AX systems and the AIF won’t really work for us unless I change the functionality of it.

try debugging from CreateJournal method call of Run method of SalesFormLetter/PurchFormLetter. I think inside insertjournal method you may find the place where the status gets updated.

May be it will be working on the Table method

InitfromPurch/SalesTable.

Thanks,

Saju.K

Thanks for the help everybody. This method does give me what I need.

I have the same problem, what method did you use? Thank you.

I have the same problem, what method did you use? Thank you.