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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Converting data type

(0) ShareShare
ReportReport
Posted on by 151

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,
I have the same question (0)
  • Suggested answer
    Alok.kulshreshtha Profile Picture
    934 on at

    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.

  • Suggested answer
    YUN ZHU Profile Picture
    98,400 Super User 2026 Season 1 on at

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

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,965 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,125 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 961 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans