Skip to main content

Notifications

Small and medium business | Business Central, N...
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,
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 71,565 Super User 2024 Season 2 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.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans