function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Can we insert an record in AccountShare Object with an reference to inactive user.?
Hi,
Yes you can insert the accountshare record. First of all you have to set the OWD is private for account and then create the public groups.
User should be in the public group have the role below your user who is creating the record.
Try the below code to create the account share:
account acc=new account(name='checkaccountshare');
insert acc;
list<GroupMember> gp=[select id,UserOrGroupId from GroupMember];
AccountShare AccShare = new AccountShare(AccountId = acc.Id,AccountAccessLevel = 'Edit', OpportunityAccessLevel = 'Read',CaseAccessLevel = 'Read', UserOrGroupId = gp[0].UserOrGroupId );
Insert AccShare;
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thanks for Reply,
No, I Still have an issue.
I agree that we have to insert AccountShare in that way. But my problem is that, i am trying to insert an reference to a user which is currently in inactive state. It throws an error in this case.
Hi,
Yes you can insert the accountshare record. First of all you have to set the OWD is private for account and then create the public groups.
User should be in the public group have the role below your user who is creating the record.
Try the below code to create the account share:
account acc=new account(name='checkaccountshare');
insert acc;
list<GroupMember> gp=[select id,UserOrGroupId from GroupMember];
AccountShare AccShare = new AccountShare(AccountId = acc.Id,AccountAccessLevel = 'Edit', OpportunityAccessLevel = 'Read',CaseAccessLevel = 'Read', UserOrGroupId = gp[0].UserOrGroupId );
Insert AccShare;
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thanks for Reply,
No, I Still have an issue.
I agree that we have to insert AccountShare in that way. But my problem is that, i am trying to insert an reference to a user which is currently in inactive state. It throws an error in this case.