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

Community site session details

Session Id :
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.
I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    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.

  • Suggested answer
    Nitin Verma Profile Picture
    21,684 Moderator 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;
  • Jazzy4321 Profile Picture
    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
    Jeffrey Bulanadi Profile Picture
    8,431 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;
            }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,327

#2
Sumit Singh Profile Picture

Sumit Singh 2,734

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,599

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans