web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Validate the Multiselect field value before importing to entity table.

(0) ShareShare
ReportReport
Posted on by 113

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);
    }

}

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    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);

  • HARISH MEHRA Profile Picture
    113 on at

    6862.Capture3.PNG

    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

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    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).

  • HARISH MEHRA Profile Picture
    113 on at

    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.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    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

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.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 517 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 440

#3
Adis Profile Picture

Adis 266 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans