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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to avoid using Hard coded values in code in AX 2012 developement

(0) ShareShare
ReportReport
Posted on by 950

Hi there,

I want ot use some of set up table data in my code and validate and take some action on selection particluar values.

e.g. Asset major Group has type as Cars then i need to do some action at code level.

How can i avoid using this type = Cars in my code?

Is there any other approch to use such values in code?

 

Regards,

Rahul

*This post is locked for comments

I have the same question (0)
  • Pranav Kumar Profile Picture
    on at
    Re: How to avoid using Hard coded values in code in AX 2012 developement

    You can use paramteric setup like creating a new field in FA parameter and validating against the value in field rather than hard coding.

    Pranav

  • Suggested answer
    Muhammad Yasir Profile Picture
    1,023 on at
    Re: How to avoid using Hard coded values in code in AX 2012 developement

    you can make an enum for the value that is to be matched.

    Yasir.

  • Suggested answer
    Joris dG Profile Picture
    17,775 on at
    Re: How to avoid using Hard coded values in code in AX 2012 developement

    Depending on the scenario and meaning of this, we typically use one of three scenarios:

    1) make a parameter table, or add a parameter to an existing parameter table where the user can select the type. This assumes that type is mostly static and has a special meaning.

    2) on the setup of the asset group, or if the cars type is a lookup and not an enum, add a checkbox where users can indicate which types have that "special meaning". Again, this assumes that type to be used is mostly static

    3) if this needs to be dynamics and can change depending on the user's needs at that very moment, prompt a dialog to ask for the type

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans