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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Creating a stringeditcontrol Label by code

(0) ShareShare
ReportReport
Posted on by 454

Hi,

I need to create label for a string edit control in a form. I need code for that . I am new to AX 

Thanks in advance,

Ram

I have the same question (0)
  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Do you mean you want to create a new label? Or assign an existing label?

    For existing label do this:

    1) Set property AutoDeclaration of the control to Yes

    2) In Init method of the form, after super(), add MyControl.label("@MyLabel") (assuming your control is called MyControl and your label id is MyLabel.

  • Ram Kumar Profile Picture
    454 on at

    Hi Nikolaos,

    I want to create new label and to assign the label for the string edit control

  • Ram Kumar Profile Picture
    454 on at

    Hi Nikolaos,

    I want to create new label and to assign the label for the string edit control

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

    Go to the properties of the control. In Label field, type the text that you want to have in the label. Then click the button in the right edge of the property field. Label editor opens, automatically searching if there is already a label that matches your text. If not, you can create a new label. Finally, click "Paste label" to bring this label Id in your stringedit control.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Ah, but you asked how to create it in code. What would be the business requirement for that? Could you share it? In general it doesn't seem like a very good idea to me. Usually you have multiple AOS instances in your prod system, and form changes, and new labels are not synced to other AOS instances if you make such changes when the application is running.

    Once we hear your business requirement, we can discuss possible solutions to it.

  • Ram Kumar Profile Picture
    454 on at

    I need to create a new label by code and i have to set for a stringeditcontrol. or i want to update the existing label with a new label . Is it possible

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

    That's not a business requirement, that's a description of a technical solution that you think would fit the business requirement.

    Could you share the business requirement? What is the process / scenario where you would use this code? I already mentioned in my previous message why it doesn't seem like a good / working idea. Please let us know more so that we can help you as good as possible.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans