Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

how to display the legal entity of user's role?

Posted on by 920

I create first a grid that displays the list of user.

I create second grid thats displays the list of roles of the selected user.

secUserRole.png

secRole.png

Now, in other tab I displayed if the role is active for all the organizations or have access to specific organizations:

0458.access.png

If the radioButton "Grant access to specific organizations individually" is selected , I want when I clicked on "next" I get the  names of organizations where the selected role is active.

I added the OMUserRoleOrganization as dataSource , in the method executeQuery() I set this code:

public void executeQuery()
{
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(OMUserRoleOrganization)), fieldnum(OMUserRoleOrganization, User)).value(queryValue(UserInfo.id));
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(OMUserRoleOrganization)), fieldnum(OMUserRoleOrganization, SecurityRole)).value(queryValue(SecurityRole.RecId));

super();
}

 Then I added OMInternalOrganization as datasource,  in the method executeQuery() I set this code:

public void executeQuery()
{
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(OMInternalOrganization)), fieldnum(OMInternalOrganization, RecId)).value(queryValue(OMUserRoleOrganization.OMInternalOrganization));
super();
}

I called these methods in clicked Button, but I didn't get values.

I want to know how to link the userInfo, SecurityRole, OMUserRoleOrganization and OMInternalOrganization  to get the names of organizations??

*This post is locked for comments

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: how to display the legal entity of user's role?

    Thanks. This would indeed prevent creating new records and now your error from above is not coming anymore. I have marked your own answer as verified.

  • Verified answer
    BASMA Profile Picture
    BASMA 920 on at
    RE: how to display the legal entity of user's role?

    Hi, André,

    4505.secUserRole.png

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: how to display the legal entity of user's role?

    Hi Basma,

    Thanks. Glad you solved it, but what exact property are you referring to?

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to display the legal entity of user's role?

    Hi André,

    it works now,

    juste I changed the property of omUserRoleOrganization.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: how to display the legal entity of user's role?

    The fact-box on the user details form is also a form. You can find it based on menu items used in the fact-box section of the form design. Please let us know if you are able to reverse engineer it now.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to display the legal entity of user's role?

    I need it in a new form, beacause there are some other tasks related to it.

    in the list of user in form, I didn't know  the source of dialogBox

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: how to display the legal entity of user's role?

    Hi Basma,

    This is already standard available. You can go to the users list page. Then open the details for one user. You can click a role. At the right side, there is a space for factboxes. Out of the box, one fact box will then show the list of organizations. If you need to present it a bit different, then use the example for the exact queries and coding.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to display the legal entity of user's role?

    The purpose of this task is :

    1. choice of user from grid

    2.display the list of roles assigned to this user.

    3.When I selected role and clicked next , I get the names of organizations where the role is active.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: how to display the legal entity of user's role?

    Hi Basma,

    What is the purpose of this adjustment? What do you want to achieve at the end of the day?

    Would be great if you could explain.

    Many thanks

    Ludwig 

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to display the legal entity of user's role?

    I add OMUserRoleOrganization as datasource:

    omUser.png

    then I add OMINternalOrganization : i link it with OMUserRoleOrganization :

    omIntern.png

    Now I get the correct organizations but when I open form I get this dialogBox:

    6761.entity.png

    I didn't understand it ?

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans