public void init() { next init(); UserInfo userInfo; SecurityUserRole securityUserRole; SecurityPrivilege securityPrivilege; SecurityRolePrivilegeExplodedGraph securityRolePrivilegeExplodedGraph; select firstonly RecId from userInfo exists join securityUserRole where securityUserRole.User == curUserId() exists join securityRolePrivilegeExplodedGraph where securityRolePrivilegeExplodedGraph.SecurityRole == securityUserRole.SecurityRole exists join securityPrivilege where securityPrivilege.RecId == securityRolePrivilegeExplodedGraph.SecurityPrivilege && securityPrivilege.Identifier == 'YOURPRIVILEGENAME' && securityUserRole.AssignmentStatus == RoleAssignmentStatus::Enabled && (securityUserRole.ValidFrom < DateTimeUtil::utcNow() || securityUserRole.ValidFrom == utcDateTimeNull()) && (securityUserRole.ValidTo > DateTimeUtil::utcNow() || securityUserRole.ValidTo == utcDateTimeNull()); // Check if the user has a specific security privilege if (userInfo.RecId) { // Find the control and hide it FormStringControl control = this.design().controlName(formControlStr(HcmWorkerV2, SN)); if (control) { control.visible(false); } } }
This blog is contains coding reference related to Microsoft AX 2012 and D365 finance and operations and Power platform
Tuesday, January 27, 2026
Find privilege assigned to a user role
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment