Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Cash Receipt Journal - set value of an enum for the Document Type

Posted on by

When a cash receipt page is opened, I want to default the Document Type to "Payment" and am trying to do it on a trigger OnNewRecord, but I am not sure how to set the value for an enum data type. Anyone do this and know what I need?

 trigger OnNewRecord(BelowxRec: Boolean)
    begin
        Rec.Validate("Document Type");
    end;
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Cash Receipt Journal - set value of an enum for the Document Type

    Hi,

    You can try below

    pageextension 88000 "CCS Cash" extends "Cash Receipt Journal"

    {

       trigger OnNewRecord(BelowxRec: Boolean)

       var

           docType: Enum "Gen. Journal Document Type";

       begin

           rec."Document Type" := docType::Payment;

       end;

    }

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    RE: Cash Receipt Journal - set value of an enum for the Document Type

    Hi, I have briefly discussed the solution to this before, and I hope the following information can give you some hints.

    How to set default Account type in General Journals (Customization)

    https://yzhums.com/26385/

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Cash Receipt Journal - set value of an enum for the Document Type

    You do it the same way as you do with an option field:

    Enum : = Enum :: TheValue;

    Rec."Document Type" := Rec."Document Type" :: Payment;

    Here is a great article of enums in AL:

    www.kauffmann.nl/.../

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans