UserRole u = new UserRole(); u.RollupDescription = 'tt'; u.OpportunityAccessForAccountOwner = 'edit'; u.Name = 'tt'; insert u;
Only thing to remember here is that you cannot do mix DML operations on setup and setup object. Check out Apex developer guide "sObjects That Cannot Be Used Together in DML Operations".
for example if your are updating account/ opportunity/custom object and in same transaction trying to update user or userrole/group objects, then you will get mix ml operation not allowed exception.
You can use future callouts to achieve it if needed.
Hi,
UserRole u = new UserRole();
u.RollupDescription = 'tt';
u.OpportunityAccessForAccountOwner = 'edit';
u.Name = 'tt';
insert u;
Only thing to remember here is that you cannot do mix DML operations on setup and setup object. Check out Apex developer guide "sObjects That Cannot Be Used Together in DML Operations".
for example if your are updating account/ opportunity/custom object and in same transaction trying to update user or userrole/group objects, then you will get mix ml operation not allowed exception.
You can use future callouts to achieve it if needed.
Hope this may help you.
Thanks,
Ahmed
Hi,
Thanxs Ahmed for your reply.
I think this will help me alot...
Regards
Divyanshu
You can marked this post as solved, so that it will be helpful to some1 else with similar issue.