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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Modify Label in Dynamics 365 with x++.

(0) ShareShare
ReportReport
Posted on by 55

Hello everyone,


Someone knows how to modify a label using code x ++ in dynamics 365, I have tried with the modify method of the class SysLabel, but this method always returns me False I have tried changing the parameters, but it never works. Agradesco who can help me, Thank you.

*This post is locked for comments

  • Martin Dráb Profile Picture
    240,965 Most Valuable Professional on at

    Please tell us what you're trying to achieve, so we can suggest a solution that actually can be done.

    Labels are compiled to .NET resource files; you can't change them at runtime.

  • Suggested answer
    Rudi Hansen Profile Picture
    4,079 on at

    In AX2012 you could use SysLabelEdit.labelModify but it seem that class does not exist in AX365.

    But like with all other development elements in AX365, if you change the file for the element, the element will also be changed in the application, so if you find the label file in the folder C:\AOSService\PackagesLocalDirectory, you can change the file directly. (Will not work in production only on you development enviroment)

  • Victor H. Cortes Profile Picture
    55 on at

    Hello Martin,

    I would like to modify the label text, I need the label of a form to be dynamic, the user will have the option of assigning the name to the form and changing it whenever he wants.

    The reason why I do not use the caption property of the form is because I need to change the text of the label globally.

    Is this possible?

  • Verified answer
    Martin Dráb Profile Picture
    240,965 Most Valuable Professional on at

    If different users (or users in different companies) should be able to set different values, changing the label wouldn't work anyway, because it would change for everyone.

    If you manage to change the resource file (which you can't), you would achieve very little, because the change would be lost at the next deployment of the package.

    I wonder what's the actual business requirement that you decided to solve by this technical solution. Maybe they should simply request a minor change and get it delivered in the usual way, assuming that you own the label file and can make changes. If not, you may also need to update properties to use a new label ID from your own package. Or maybe you need something more complicated, e.g. if you want different users to set different values.

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    If the users should be able to change the caption of the form globally, by changing some setting in the system, labels are not ideal for that.

    Instead the user input should be saved to a new setup table, and in the form's init method, assigned to the caption property.

    You could even have language support, if you add languageId as a field to your setup table.

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans