Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Modify Label in Dynamics 365 with x++.

    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.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,503 Most Valuable Professional on at
    RE: Modify Label in Dynamics 365 with x++.

    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.

  • RE: Modify Label in Dynamics 365 with x++.

    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?

  • Suggested answer
    Rudi Hansen Profile Picture
    Rudi Hansen 4,004 on at
    RE: Modify Label in Dynamics 365 with x++.

    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)

  • Martin Dráb Profile Picture
    Martin Dráb 230,503 Most Valuable Professional on at
    RE: Modify Label in Dynamics 365 with x++.

    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.

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,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans