You need to sign in to do that
Don't have an account?
Devendra Sawant
Avoid Duplicate Role
Hi,
How to avoid user from creating duplicate roles ?
Regards,
Devendra S
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hi,
How to avoid user from creating duplicate roles ?
Regards,
Devendra S
Hi,
U can use the following trigger for checking duplicate role.
trigger rolecheck on User(before insert)
{
List<User> ulist=[select UserRoleId from User where isActive=true];
Map<id,User> m=new Map<id,User>();
for(User u1:ulist)
{
m.put(u1.UserRoleId,u1);
}
for(User u:Trigger.new)
{
if(m.get(u.UserRoleId)!=null)
{
u.addError('Error Message');
}
{
}
}
}
Thanks,
Malar
Duplicate role?
Please elaborate the requirement.
I guess below steps will help in your development.
-Query all the roles and take it in a map<String, sObject> and put the each role in map's keyset.
-Before inserting new Role from vf page, check if the role already exists (show page message that role exists.)
and if Role doesn't exists, Create it.