Hey Team,
I'm have assigned a security role to an associate I'm adding using x but I also want to add an organisation along with the role. I want to do it using x . Please can you suggest me how to do this as I'm very confused.
Following is my code for assigning the role to the associate. Please help me in assigning the organisation to the associate along with the role as It's a bit confusing. I could only figure out that the table related to assigning the organisation is "omUserRoleOrganization"
select role where role.Name=="Accountant";
select * from userRole
where userRole.SecurityRole == role.RecId && userRole.User == systemuser.UserID;
userRole.User = systemuser.UserID;
userRole.SecurityRole = role.RecId;
userRole.AssignmentMode = RoleAssignmentMode::Manual;
userRole.AssignmentStatus = RoleAssignmentStatus::Enabled;
SecuritySegregationOfDuties::assignUserToRole(userRole, null);
info(strFmt("Role %1 added to the user %2 successfully.", role.Name, systemuser.UserId));