Notifications
Announcements
No record found.
Good Morning,
I am trying to understand what does MapDatasourceToEntity method actually does ?
Please provide some example to understand.
Regards,
Have a great day.
The same question has been answered in previous thread. Take a look
community.dynamics.com/.../data-entity-methods
Hi Satish ,
Thanks for the reply.
I have seen this post
but here it is mentioned like this.
MapdatasourcetoEntity- if you want to write any custom logic while exporting data out of the system you can override this method
I donot understand "out of system".
Can you please give me an example.
Regards.
Out of the system means for exporting . Use metadata search to find standard example.
Hi AX2012 r3,
There is another method called "mapEntityToDataSource".
Please have a look at the following DOC:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/data-entity-computed-columns-virtual-fields#example-use-a-virtual-field-to-receive-and-parse-an-inbound-field
This method contains the logic of the inbound field.
And "MapDatasourceToEntity" is the opposite method to write codes about outbound fields.
The so-called outbound and inbound means the import and export of entity data.
Hope this helps.
Here for testing i created one entity and i have one field extraamount (real).
I have this field in table and Data entity and Staging.
I tried filling this as 50 in "MapDatasourceToEntity" But it is not getting filled when exported.
Am i missing any thing.
Please guide.
Hi partner,
Please provide your code if possible.
public void mapDataSourceToEntity(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { if(_dataSourceCtx.name() == dataEntityDataSourceStr(DEntityTableEntity, DEntityTable)) { this.ExtraAmount = 50; this.Description = "123"; } super(_entityCtx, _dataSourceCtx); }
Second Way i tried
public void mapDataSourceToEntity(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { if(_dataSourceCtx.name() == dataEntityDataSourceStr(DEntityTableEntity, DEntityTable)) { DEntityTable de = _dataSourceCtx.getBuffer(); de.ExtraAmount = 50; de.Description = "123"; } super(_entityCtx, _dataSourceCtx); }
Please tell me what wrong did i do
It seems you are assigning values to the table DEntityTable, but this method is to pass the values in the table to the entity.
de.ExtraAmount = 50;de.Description = "123";
If your entity contains these two fields.You can try to change them into:
this.ExtraAmount =50;
this.Description ="123";
Hi,
I donot understand which one to be considered i tried both but not able to export.
Can you provide any example code
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 646 Most Valuable Professional
André Arnaud de Cal... 529 Super User 2025 Season 2
Sohaib Cheema 285 User Group Leader