Hi Experts,
I want to validate and import the multi select field data in Sales Order Line V2 Entity.
The file is importing successfully but the data in my Multiselect Field(ManufacturingPlant_CAP) is not updating.
can anyone help out here.
[Extensionof(tableStr(SalesOrderLineV2Entity))] internal final class SalesLineManufacturingPlantImp_CAP_Extension { public static void postTargetProcess(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution) { SalesLine salesline; InventSite inventSite; container tmpValues,chk; int idx; //check if import job is finished if (_dmfDefinitionGroupExecution.StagingStatus == DMFBatchJobStatus::Finished) { SalesOrderLineV2Staging salesOrderLineV2Staging; ttsbegin; while select salesOrderLineV2Staging where salesOrderLineV2Staging.DefinitionGroup == _dmfDefinitionGroupExecution.DefinitionGroup && salesOrderLineV2Staging.ExecutionId == _dmfDefinitionGroupExecution.ExecutionId && salesOrderLineV2Staging.TransferStatus == DMFTransferStatus::Completed { if (salesOrderLineV2Staging.SalesOrderNumber != '') { tmpValues = str2con(salesOrderLineV2Staging.ManufacturingPlant_CAP, ';'); for (idx = 1; idx <= conLen(tmpValues); idx ) { inventSite = InventSite::find(conPeek(tmpValues, idx)); if (! inventSite.RecId) { error(strFmt("Value '%1' in Manufacturing Plant Field is not valid", conPeek(tmpValues, idx))); } } salesline.ManufacturingPlant_CAP = salesOrderLineV2Staging.ManufacturingPlant_CAP; salesline.update(); ttscommit; } } } next postTargetProcess(_dmfDefinitionGroupExecution); } }
For field missing in exported file, please generate mapping for the data entity and add it in project again and try.
For salesLine null, try removing call to next in postTargetProcess method
www.songnghia.com/.../d365-fo-method-calling-sequence-of-data.html
Yes ,debug postTargetProcess method and in salesOrderLineV2Staging table I am getting the field(ManufacturingPlant_CAP) data but in salesline variable it is showing null for all fields.
One more thing - When I am Exporting the Entity .My added fields are missing in that exported file.
NOTE - I have added my fields in both Entity as well as in Staging table.
Have you debugged postTargetProcess method? Is salesLine update method is called with correct value.
Also, you might want to re-check the placement of code. If you want to validate that the string values have a valid site in system then probably use ValidateWrite method and instead of postTargetProcess method, use mapEntityToDatasource.
learn.microsoft.com/.../validations-defaults-unmapped-fields
Hope you already know that postTargetProcess method is not called via OData (consider for future work).
Hello Rampal,
Added the line but result is same. Actually in staging table it is showing the correct updated data which I have entered in excel sheet. But When I an checking in SalesLine table it is not updating.
Thanks
Hi Harish, Are you getting anything in SalesLine table buffer. If not then try adding below code at Line# 32
salesline = SalesLine::find(salesOrderLineV2Staging.SalesOrderNumber, salesOrderLineV2Staging.LineNum, true);
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156