You need to sign in to do that
Don't have an account?
IntegrationUser
Problems trying to insert a row into AccountShare via the API
When I try to insert a row into accountshare and include the ContactAccessLevel field, I get the following error message:
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]);
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]);
This field must be set to an access level that is at least equal to the organization’s default ContactAccessLevel. This field cannot be updated via the API if the ContactAccessLevel field is set to “Controlled by Parent,” you cannot update this field for the associated account owner using the API. You must update the account owner’s ContactAccessLevel via the Salesforce user interface.
is it possible that you have controlled by parent enabled ?