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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Codeunit::"CRM Setup Defaults" fields doesn't exist in current context

(0) ShareShare
ReportReport
Posted on by 35

Hi,

I'm having a hard time following the 'Customizing an Integration with Microsoft Dataverse' guide on the Docs website and I'm currently on the step where you gotta use the Codeunit CRM Setup Defaults (ID 5334) to subscribe on the OnAddEntityTableMapping event in order to enable deep linking between coupled Business Central records and Microsoft Dataverse records.

[EventSubscriber(ObjectType::CodeunitCodeunit::"CRM Setup Defaults", 'OnAddEntityTableMapping''', true, true)]
    local procedure HandleOnAddEntityTableMapping(var TempNameValueBuffer: Record "Name/Value Buffer" temporary)
    var
        CRMSetupDefaults: Codeunit "CRM Setup Defaults";
    begin
        CRMSetupDefaults.AddEntityTableMapping('Order Type'DATABASE::"LGX SNV Order Type", TempNameValueBuffer);
        CRMSetupDefaults.AddEntityTableMapping('Order Type'DATABASE::"CRM new_ordertype", TempNameValueBuffer);
    end;

But when I try to use the procedure for adding the entity, it gets highlited in red stating that the codeunit does not contains a definition for the procedure I'm trying to use.

'Codeunit "CRM Setup Defaults"' does not contain a definition for 'AddEntityTableMapping'AL(AL0132)

Is there any way to fix this? I just checked the codeunit and the procedure is there. I'm wondering if it could be something permission-related.

I would really appreciate any help with this. Thanks

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    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

    dynamicsuser.net/.../developerss

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

    Thanks.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,255 Super User 2025 Season 2 on at

    I don't see that function in the codeunit either, which version of BC are using ? OnPrem or Saas?

  • Gelatina Profile Picture
    35 on at

    I'm using Saas, but I am actually able to see the procedure in the codeunit, nonetheless it is being marked as if the codeunit doesn't exist in the current context.

    Doesn't matter if I import it on an event subscriber, on a variable on a page, however I try to use it is being marked regardless of it's existance.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,255 Super User 2025 Season 2 on at

    I checked with current version and I could not see that function. Maybe the symbols you have are old and referencing the new version.

  • IronBark Profile Picture
    5 on at

    Hi there,

    I has this problem as well (I'm on the latest BC v18.3).

    Add this code to your codeunit:
        local procedure AddEntityTableMapping(CRMEntityTypeName: Text; TableID: Integervar TempNameValueBuffer: Record "Name/Value Buffer" temporary)

        //Replicates the same local procedure in Codeunit "CRM Setup Defaults"
        begin
            //OnBeforeAddEntityTableMapping(CRMEntityTypeName, TableID, TempNameValueBuffer); //Note, if you subscribe to this you'll need to cater for this as well.
            TempNameValueBuffer.Init();
            TempNameValueBuffer.ID := TempNameValueBuffer.Count + 1;
            TempNameValueBuffer.Name := CopyStr(CRMEntityTypeName, 1, MaxStrLen(TempNameValueBuffer.Name));
            TempNameValueBuffer.Value := Format(TableID);
            TempNameValueBuffer.Insert();
        end;
    and replace:
     CRMSetupDefaults.AddEntityTableMapping('Order Type', DATABASE::"LGX SNV Order Type", TempNameValueBuffer);
    CRMSetupDefaults.AddEntityTableMapping('Order Type', DATABASE::"CRM new_ordertype", TempNameValueBuffer);
    with:
     AddEntityTableMapping('Order Type', DATABASE::"LGX SNV Order Type", TempNameValueBuffer);
    AddEntityTableMapping('Order Type', DATABASE::"CRM new_ordertype", TempNameValueBuffer);

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,957

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,245

#3
YUN ZHU Profile Picture

YUN ZHU 1,045 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans