Skip to main content

Notifications

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

Finding variable names dynamically

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 73,339 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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans