Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Converting data type

Posted on by 127

I have my table with field "EntryType" of Option datatype with options new, renewal &cancellation I want to add this particular option for specific entryNo to the code of "reason code"

table(231)

For Example for entry  001, EntryType is "New" then I want to add this to code of "Reason code" Table similar for different entries I tried some code but it doesnt working

  local procedure reasoncode()
    var
        ReasonCode: Record 231;
    begin
        if not ReasonCode.Get(format(InsuranceTable."Transaction  Type")) then begin
            ReasonCode.Init();
            ReasonCode.Code := format(InsuranceTable."Transaction  Type");
            ReasonCode.Insert(true);
        end

    end;
thanks,
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 64,563 Super User on at
    RE: Converting data type

    Hi, Maybe it's an Enum value issue?

    Hope the following will help.

    https://www.kauffmann.nl/2020/07/16/converting-enum-values-in-al/

    Thanks.

    ZHU

  • Suggested answer
    Alok.kulshreshtha Profile Picture
    Alok.kulshreshtha 934 on at
    RE: Converting data type

    Hi, 

    I have run your code and it seems working. in my test i used Item ledger entry -> entry Type column and value is inserting into Reason code. 

    pastedimage1653238965063v1.png

    and below is a result after execute a code. 

    pastedimage1653239022569v2.png

    May i know how you are calling procedure reason code? better to enable debugger and check execution flow. 

    Regards,

    Alok Kulshreshtha

     

    Please Verify my answer if you find my post helpful.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans