Notifications
Announcements
No record found.
Hi,
I have a table (TableDemo) that is also used in my entity. After the execution of the entity, i want to update a certain field of this table (tableDemo) for all used records in this entityThis table is inner joined with the main dataSource of the entity.
You can write code in postLoad (import) or mapEntityToDataSource (export) methods of the entity to achieve that.
You can check the MS doc regarding virtual fields - the use case is a bit different (populate field on import / export) but you can also use similar logic in your case to update a field on export / import.
docs.microsoft.com/.../data-entity-computed-columns-virtual-fields
Hi IntegrationBeginner,
Are you talking about the export or import scenario?
For export scenarios, you can use postLoad or DMFDefinitionGroupExecution.update method.
Check the thread for more examples: community.dynamics.com/.../is-there-a-work-around-to-enable-incremental-push-for-composite-entities
For import scenarios you can use postTargetProcess method
ievgensaxblog.wordpress.com/.../
Hi Sergie and Nikolaos,
Thanks alot both of you. My question was about export.
I've read your responses in addition to your responses in this link: https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/410246/is-there-a-work-around-to-enable-incremental-push-for-composite-entities
Based on what i read from this link, postLoad will update the field even if the export failed. So i prefer to use the other suggestion which is DMFDefinitionGroupExecution.update method but i got confused alittle on how to use it.
So in postLoad, i would have said select forupdate table where table.uniquefield == this.uniqueField then update.
A) However in this method below, you are looping through the staging table, so am i going to put inside this staging table loop the same thing as postLoad? as shown below?
ttsbegin; while select MyRootStaging where MyRootStaging.DefinitionGroup == dmfDefinitionGroupExecution.DefinitionGroup && MyRootStaging.ExecutionId == dmfDefinitionGroupExecution.ExecutionId { select forupdate tableDemo where tableDemo.UniqueField == MyRootStaging.FieldWithValueAsUniqueFieldOftableDemo; tableDemo.Field1 = new value; tableDemo.update(); } ttscommit;
B) also it was suggested to use postLoad or mapEntityToDataSource, may i know the difference between these two methods and when would i need to use each one?
The Mapentitytodatasource method is used to map inbound field to underlying target datasource. See:
Please try the updateEntityDataSource method:
public boolean updateEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { Yourtable table =_dataSourceCtx.getBuffer(); table.yourfield="....." return super(_entityCtx, _dataSourceCtx); }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 611 Most Valuable Professional
André Arnaud de Cal... 529 Super User 2025 Season 2
Sohaib Cheema 285 User Group Leader