-->

How to reference new field if it is DAC Extension

2019-07-29 09:31发布

问题:

I have a couple of new fields in Sales Order (Screen ID - SM204505). I have added these fields from customization project > Data Access. Once published this customization project all the new fields are created in SOOrder table.

Now I want to reference these new fields in my Customization Project in Visual Studio to fill some other values (i.e. add some more business logic). For example, there is a custom field called UsrReasonCode added to SOOrder table. And then I want to write some business logic to get this value from SOOrder and fill into some other table (i.e. Document Line item > ReasonCode)

It is working if I create Table Extension but I am not sure how to reference if I add it through DAC Extension. Please suggest.

回答1:

You can reference extension fields by using extension object like that:

DocExt ext=PXCache<Doc>.GetExtension<DocExt>(doc);

This will get extension object DocExt related to the original Doc object. So you can reference extension fields like ext.UsrField.

To read more about that you can download T300 training from acumatica university



标签: acumatica