• IntegrationUser
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
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]);
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?


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?