You need to sign in to do that
Don't have an account?
abhinav gangrade
Apex record sharing
I am working on writing apex sharing anonymous code,
for(Account abc: [select Owner, CreatedBy, LastModifiedBy from account where CALENDAR_YEAR(createddate) = 2014]
How to assign UserOrGroupId with Owner, CreatedBy, LastModifiedBy for one account record. Pls suggest.
for(Account abc: [select Owner, CreatedBy, LastModifiedBy from account where CALENDAR_YEAR(createddate) = 2014]
How to assign UserOrGroupId with Owner, CreatedBy, LastModifiedBy for one account record. Pls suggest.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_creating_with_apex.htm
for(Account abc: [select Owner, CreatedBy, LastModifiedBy from account where CALENDAR_YEAR(createddate) = 2014]){
AccountShare accShare = new AccountShare();
accShare.UserOrGroupId = abc.OwnerId;
accShare.rowcause = 'Manual';
accShare.AccessLevel = 'Read';
}
//Add the above instance into the list and after for look, insert the list.
Hope this helps.