Skip to main content

Notifications

Business Central forum
Suggested answer

Customisation Dynamics Sales Integration - Insert Constant Value to BC table

Posted on by 2,352
Hi All
I'm customising the integration between dynamics sales and BC. When a Order from Dynamics Sales comes into BC, I want set a field in BC with a static value . For example field on the sales header "CreatedByIntegration"set to true (boolean field)
 
tried below in integration table mapping but no success:
            InsertIntegrationFieldMapping(
                IntegrationTableMappingName,
                BCTable.FieldNo(CreatedByIntegration),
                DataverseTable.FieldNo(SubmitStatus),//not relevant
                IntegrationFieldMapping.Direction::FromIntegrationTable,
                'true', false, false);//set true on const 
Categories:
  • Samantha73 Profile Picture
    Samantha73 2,352 on at
    Customisation Dynamics Sales Integration - Insert Constant Value to BC table
    The event for the above code:
     [EventSubscriber(ObjectType::Codeunit, Codeunit::"CDS Setup Defaults", OnAfterResetConfiguration, '', true, true)]
        local procedure OnAfterResetConfiguration(CDSConnectionSetup: Record "CDS Connection Setup")
        var
            DataverseTable: Record "CRM Salesorder";
            BCTable: Record "Sales Header";
            IntegrationFieldMapping: Record "Integration Field Mapping";
            IntegrationTableMapping: Record "Integration Table Mapping";
            IntegrationTableMappingName: Code[20];
        begin
            IntegrationTableMapping.SetRange(Name, 'SALESORDER-ORDER');
            if IntegrationTableMapping.FindFirst() then begin
                IntegrationTableMappingName := IntegrationTableMapping.Name;
     
                IntegrationTableMapping.Validate(Direction, IntegrationTableMapping.Direction::Bidirectional);
                IntegrationTableMapping.Validate("Synch. Only Coupled Records", false);
     
                //---field values---
                //1.Synched by Integration set const value
                InsertIntegrationFieldMapping(
                    IntegrationTableMappingName,
                    BCTable.FieldNo(CreatedByIntegration),
                    DataverseTable.FieldNo(SubmitStatus),
                    IntegrationFieldMapping.Direction::FromIntegrationTable,
                    'true', false, false);
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,027 Super User 2024 Season 1 on at
    Customisation Dynamics Sales Integration - Insert Constant Value to BC table
    Hi,
    Can you share your code with with event, in which event you are trying?
     

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

News and Announcements

Give Back to the Community this Month

Quick Links

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,807 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans