You need to sign in to do that
Don't have an account?

How do I create a new AccountShare / OpportunityShare row via the API?
I have written an S-Control which switches Account owners to different owners. I would also like to be able to switch any manual shares for accounts and opportunities. I don't seem to be able to create new rows in either the AccountShare or OpportunityShare show because the RowCause field is readonly.
Is there a better way to switch manual AccountShares / OpportunityShares to a different user via the API?
Is there a better way to switch manual AccountShares / OpportunityShares to a different user via the API?
fields:ContactAccessLevel', message:'AccountShare: bad field names on insert/update call: ContactAccessLevel, statusCode:'INVALID_FIELD_FOR_INSERT_UPDATE',}
However, if I exclude this field I get the following error message:
fields:AccountAccessLevel, OpportunityAccessLevel, CaseAccessLevel, message:
:AccountAccessLevel,OpportunityAccessLevel,CaseAccesLevel(Account,Opportunity,Case Levels, Con Levels(All, Edit, None, Edit) are below organization levels(Read, None, None, ControlledByParent))', statusCode:'INVALID_ACCESS_LEVEL'),}
Here is the JavaScript code I am using in my S-Control:
var newAccountShare = new sforce.SObject("AccountShare");
newAccountShare.UserOrGroupId = randomUserId;
newAccountShare.AccountId = accountId;
newAccountShare.AccountAccessLevel = "All";
newAccountShare.OpportunityAccessLevel = "Edit";
newAccountShare.CaseAccessLevel = "Edit";
newAccountShare.ContactAccessLevel = "Edit";
var createResults = sforce.connection.create([newAccountShare]);
Hi,
Have you got any workaround / root cause for this problem? I am also getting same error and looking for workaround.
Thanks in advance.
V.R.
It's working with value "manual"
CaseShare testcaseshare = new CaseShare(UserOrGroupId = curuserID,CaseId = testcase.id,CaseAccessLevel = 'manual');
Sorry, it isn't working at all. All my test where coverd, but when I tried it again, I got an error again :-(
Why isn't it working?