Hello. I have a small issue, again ;)
As we know, in the option field proporties we can assign two proporties: Option String and Option Caption. In my case, I am trying to decode Option Caption to Option String for Payment Terms in CRM and NAV Integration. My properties:
OptionString: 7D,14D,30D,60D,90D
OptionCaption: 7 Days,14 Days,30 Days,60 Days, 90 Days (and OptionCaptionML simmilar for specific language).
Now, in Dynamics CRM Sales Order Page there is pretty value for Payment Terms, getted from OPTION CAPTION (f.ex. 60 Days). When I am tryign to validate field while creating Sales Order in NAV using:
SalesHeader.VALIDATE("Payment Terms Code", FORMAT(CRMSalesorder.PaymentTermsCode));
there is an error that there is no payment definition (60 Days) in Payment Terms table. And is is true. There is no 60 Days code, but 60D.
It is possible to... decode (?) OptionCaption 60 Days to OptionString 60D ?
*This post is locked for comments
That was a point :)
LOCAL GetOptionValue(Table : Integer;Field : Integer;Value : Integer) : Text RecordRef.OPEN(Table); FieldRef := RecordRef.FIELD(Field); TempString := FieldRef.OPTIONSTRING; RecordRef.CLOSE; EXIT(SELECTSTR(Value+1,TempString));
and then
EVALUATE(OptVal, FORMAT(CRMSalesorder.PaymentTermsCode,0,9)); SalesHeader.VALIDATE("Payment Terms Code", GetOptionValue(DATABASE::"CRM Salesorder",28,OptVal));
Check Codeunit 5302 Outlook Synch. Type Conv, it has some functions for you to convert OptionToText and Vice Versa.
This is bad idea :( What if the caption is in multilingual ?
In this situation you'll need a data mapping.
CASE FORMAT(CRMSalesorder.PaymentTermsCode) OF '60 Days': SalesHeader.VALIDATE("Payment Terms Code", '60D'); '30 Days': SalesHeader.VALIDATE("Payment Terms Code", '30D'); ... END;
You can handle this through code, or a new field/table to lookup the NAV-value using the CRM-value.
Yes, it is this field - the Code field and I need to decode from option caption using option string (where is the payment definition) to payment code
Hi,
The field "Code" of the table Payment Terms is a Code10-field and not an Option-field.
Do you mean this field or a new field you've created?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156