Notifications
Announcements
No record found.
How to get a list of companies based on specific user ?
*This post is locked for comments
Hi,
What do you mean exactly?
The companies somebody has access to or the one he worked in, etc.?
Would be great if you could clarify.
Thanks,
Ludwig
Hi Gnanaprakash,
Please try following code:
UserId userId = curUserId(); CompanyInfo companyInfo; OMUserRoleOrganization oMUserRoleOrganization; container result; while select companyInfo exists join oMUserRoleOrganization where oMUserRoleOrganization.OMInternalOrganization == companyInfo.RecId && oMUserRoleOrganization.User == userId { result += [companyInfo.Name, companyInfo.DataArea]; } if (!result) { // no specific company for user --> all while select companyInfo { result += [companyInfo.Name, companyInfo.DataArea]; } }
Thanks for reply,
Yes i want the list of companies somebody has access to. How can i get that through x++ code?
Hi Ada Ding,
Does the above code supposed to get the list of companies somebody has access to?
When I am running it in a job, I am not get expected result.
If you don't have the correct result, you can also have a look at my example for restricting access to legal entities. The examples do contain some logic to determine legal entity access in general or per role. kaya-consulting.com/extensible-data-security-examples-secure-by-legal-entity
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2