Notifications
Announcements
No record found.
Hi Experts,
I have created my custom Table and Entity. When I am entering the Percentage field value in form then Qty field automatically update. But when I am doing the same through entity the Qty field not updating. I have written the update code in Table - modifiedField method.Can anyone help me on this.
Hi Harish, ModifiedField is a table method and won't be called automatically. However, I think you can call it inside Data Entity method like MapEntityToDataSource by providing table and field name.
https://msdaxpulse.wordpress.com/2020/08/26/modifying-datasource-values-on-data-entities-using-mapentitytodatasource-method-on-data-entities-d365fo-x/
www.dynamicsuser.net/.../52112
Thanks Mohit.
I will apply this .
Hi Harish,
Modified field is an event and it will be triggered when field is modified. But you are talking about the data entity - Can you tell me how you are modifying the records using data entity?
Thanks,
Girish S.
Hi Girish,
Actually I am calling table ModifiedField method from the Entity validateWrite().
public boolean validateWrite()
{
boolean ret;
StockPredictions_CAP stockPredictions_CAP;
ret = super();
stockPredictions_CAP.modifiedField(StockPredictions_CAP.Group1Percent);
return ret;
}
I will use insert or update table method for this scenario.
Instead of calling at validateWrite, can you try initValue or mapEntityToDataSource method of Data entity. And is it working in validateWrite?
Hi Mohit,
InitValue method of data entity is not accepting FieldId-->
public void initValue(FieldId _fieldId)
super(_fieldId);
switch(_fieldId)
That's right, initValue will not accept fieldId. Please try below code.
public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) { DataEntityDatabaseOperation dbOp = _entityCtx.getDatabaseOperation(); stockPredictions_CAP stockPredictions; super(_entityCtx, _dataSourceCtx); if (dbOp == DataEntityDatabaseOperation::Insert || dbOp == DataEntityDatabaseOperation::Update) { switch (_dataSourceCtx.name()) { case dataEntityDataSourceStr(YourCustomDataEntity, DataEntityDataSource): CustomDataEntityName customDataEntityRecord = _entityCtx.getEntityRecord(); stockPredictions = _dataSourceCtx.getBuffer(); stockPredictions.Group1Percent = customDataEntityRecord.Group1Percent; stockPredictions.modifiedField(fieldNum(stockPredictions_CAP, Group1Percent)); } } }
Yes this code works.
Thanks!!
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 692 Most Valuable Professional
André Arnaud de Cal... 558 Super User 2025 Season 2
Sohaib Cheema 364 User Group Leader