Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

CRM to Business Central custom integration of GUID field

(0) ShareShare
ReportReport
Posted on by 26

I have an integration between CRM and Business Central (both online) and it's working great for data types that are the same in both systems. I would like to sync a lookup field (guid) from CRM to Business Central by passing the name in the lookup field (custom mapping) to a text field in BC. I have the following in a table extension:

field(60120; new_University; Guid)
        {
            ExternalName = 'new_university';
            ExternalType = 'Lookup';
            Description = '';
            Caption = 'University';
            TableRelation = "CRM Account".AccountId;
        }
and i want to create an entry in the Integration Table Mapping for Customer. I have other fields working just fine, but can't figure out the best way to sync this lookup field.
Thanks.
  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    Jeffrey Bulanadi 644 on at
    RE: CRM to Business Central custom integration of GUID field

    Hi Jazzy,

     

    You can achieve the above requirement by making the fieldclass property to FlowField and default a calcformula which then uses your GUID field for lookup.

     

    Please see the below image.

    pastedimage1661670690617v1.png

            field(21; OwningBusinessUnit; GUID)
            {
                ExternalName = 'owningbusinessunit';
                ExternalType = 'Lookup';
                ExternalAccess = Read;
                Description = 'Unique identifier for the business unit that owns the record';
                Caption = 'Owning Business Unit';
                TableRelation = "CRM BusinessUnit".BusinessUnitId;
            }
            field(24; OwningBusinessUnitName; Text[160])
            {
                FieldClass = FlowField;
                CalcFormula = lookup("CRM BusinessUnit".Name where(BusinessUnitId = field(OwningBusinessUnit)));
                ExternalName = 'owningbusinessunitname';
                ExternalType = 'String';
                ExternalAccess = Read;
            }

  • Jazzy4321 Profile Picture
    Jazzy4321 26 on at
    RE: CRM to Business Central custom integration of GUID field

    I am able to do this for a variety of fields, but when i map a lookup from CRM it brings the GUID. I would like to get the name in the lookup and insert into a custom text field BC. Not sure how to do this or if there is a better way.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: CRM to Business Central custom integration of GUID field

    Hi,

    You have to use the OnAfterResetCustomerAccountMapping event with codeunit "CDS Setup Defaults" and define the fields there whichever you want to transfer into BC central Table.

        [EventSubscriber(ObjectType::Codeunit, Codeunit::"CDS Setup Defaults", 'OnAfterResetCustomerAccountMapping', '', true, true)]
        local procedure HandleOnAfterResetCustomerAccountMapping(IntegrationTableMappingName: Code[20])
        var
            CDSAccount: Record "CRM Account";
            CustomerRec: Record Customer;
            IntegrationFieldMapping: Record "Integration Field Mapping";
        begin
            //CDSAccountID for Customer
            InsertIntegrationFieldMapping(IntegrationTableMappingName, CustomerRec.FieldNo("NXN CDS Account ID"), CDSAccount.FieldNo(AccountId), IntegrationFieldMapping.Direction::Bidirectional, '', true, false);
            InsertIntegrationFieldMapping(IntegrationTableMappingName, CustomerRec.FieldNo("No."), CDSAccount.FieldNo(ceda_BC), IntegrationFieldMapping.Direction::Bidirectional, '', true, false);
        end;
  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: CRM to Business Central custom integration of GUID field

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    www.dynamicsuser.net/.../14

    I will open this up to the community in case they have something to add.

    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.

Helpful resources

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans