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

Announcements

News and Announcements icon
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
    Microsoft Employee on at

    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

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

    Yasir.

  • Suggested answer
    Joris dG Profile Picture
    17,782 on at

    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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans