Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Finding variable names dynamically

(0) ShareShare
ReportReport
Posted on by 5

Hi there, 

i set a filter on a a record and for each record i need to set a specific Boolean to true or false.


Now the problem is that there are many booleans! Is there a way to assigned variables dynamically?

Basically what i'm asking is: are there variable variable-names?

Background: the property ShowMandatory on a page field is set through variables on the Item Card. And as you know: The Item Card got many fields by default.

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: Finding variable names dynamically

    hello

    what you would like to do would have been possible if the shomandatory property had accepted functions.

    but the shomandatory property cannot validate an AL function.

    greetings

    DAniele

  • fudgi Profile Picture
    fudgi 5 on at
    RE: Finding variable names dynamically

    thx for your answer, but i think it wouldn't help me setting all the different variables in a more comfortable way:

    pastedimage1666249055441v1.png
    each field has its own variable, because they can each have a different state in my scenario.

    that's why i thought there might be a way of saying "isfield<variable>Mandatory := checkMandatoryState();".


  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: Finding variable names dynamically

    Hi, There is a simple example in method 3 below, hope will give you some hints.

    Using RecordRef Data TypeFieldRef Data Type and Field table.

    https://yzhums.com/28900/

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Finding variable names dynamically

    Maybe recordref is what you are looking for?

    learn.microsoft.com/.../recordref-data-type

    That lets you dynamically access any field in any table in BC.

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans