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)

creating AOT object from code

(0) ShareShare
ReportReport
Posted on by 8,705 Moderator

In the next sampe I'm creating AOT object from code, it works fine, But I don't get the label in the AOT, It is always the translated text. any suggestions?

both green lines get the translated label and not the ID

 

#Properties

str label;

#define.priv('\\Security\\Privileges')

MenuFunction menuFunction = new MenuFunction(_args.menuItemName(), _args.menuItemType());

TreeNode priviligeNode = TreeNode::findNode(#priv);

TreeNode roleNode = PriviligeNode.AOTfindChild(strFmt('%1View',menuFunction.name()));

roleNode = PriviligeNode.AOTadd(strFmt('%1View',menuFunction.name()));

roleNode.AOTsetProperty(#PropertyLabel, menuFunction.label());

roleNode.AOTsetProperty(#PropertyDescription,  "@SYS53654");

roleNode.AOTsave();

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Daniel Weichsel Profile Picture
    on at
    RE: creating AOT object from code

    Try using literalStr around your label ID so that the label does not get translated immediately:

    roleNode.AOTsetProperty(#PropertyDescription,  literalStr("@SYS53654"));

  • Dick Wenning Profile Picture
    8,705 Moderator on at
    RE: creating AOT object from code

    the literalStr did the job for the @SYS1243

    now I still have to solve

    roleNode.AOTsetProperty(#PropertyLabel, menuFunction.label());

  • Verified answer
    Daniel Weichsel Profile Picture
    on at
    RE: creating AOT object from code

    Hi Dick,

    In that case you can use the AOTgetProperty method:

    roleNode.AOTsetProperty(#PropertyLabel, menuFunction.AOTgetProperty(#PropertyLabel));

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans