BC and CRM Integration

xHorizon
xHorizon Member Posts: 6

Hi there,

I got a question regarding extending the bc and crm integration.
Has anyone had trouble getting the option set based coupling to work for custom fields?
So for example like Microsoft did for "Sales Header"."Payment Terms Code" -> "CRM Salesorder".PaymentCodeTermsEnum field.
A client of mine wanted me to sync a code field to a custom picklist field in crm.
So JaI implemented it like Microsoft did for payment terms and the initial
coupling both manually coupling and match based coupling worked the
records were indeed coupled.
But when the sync engine began to start syncing the data between those records I got error messages from the CRM side.
The error message essentially telling me something like this.

"Microsoft.Dynamics.Nav.CrmCustomizationHelper.CrmHelper.UpdateOptionSetMetadataWithLanguageCode"
with the following error messagfe: For OptionSet MyCustomOptionSetName:
Cannot access indirectly the option set and option values using the
entity and attribute name because the option set is not Local."

So I got confused, and googled a bit to essentially get to the conclusion that there are global choices and local choices in CRM, and I guess microsofts implementation for option based coupling is targeted only for "local choices"?
So what I'm still confused about is do I have to map the ordinal values and names of my enum field in my custom integration 1:1 to the CRM Option-Set members so they match
exactly when its a global choice field?
Because right now my enum field on my CRM-proxy table that is used for the integration does only contain a enum field with "dummy" placeholder values that do not actually exist in CRM.
Because I thought that the framework is handling the resolution of already coupled "Codes" -> Option IDs via the "CRM Option Mapping" table in BC where the Record-ID of BC is used to lookup the "Option Value" (Integer) so the actual Ordinal value of the option set in CRM and "Option Value Caption" for its display value.
But my understanding now is with global choices I don't have to implement
the option based coupling/mapping but rather match the enum values 1:1
and then write custom code that maps the ordinal value (CRM Proxy-Table)
-> Code field in BC by handling it in "OnTransferFieldData".
Which I'm even more confused because there is actual code that should handle
my scenario in the functions of "ConvertTableToOption" and "ConvertOptionToTable" in "CRM Int. Table Subscriber" → "OnTransferFieldData".

If you could help me out or elaborate if I'm right about my assumption that I have to actually start over and implement "custom" logic for resolving the mapping, or If local and global choices are actually meant to be synced by the option based coupling + the functions
"ConvertTableToOption", "ConvertOptionToTable".

Any help would be really appreciated!