+ Start a Discussion
GlennWGlennW 

Error on Creating AccountShare object

As part of an account merge I would like to move account share objects from one account to another.  Because the accountID on the account share is not updateable I simply Clone the object and create it with the new accountID.  This works great for Notes, attachments and other objects that don't allow the parentID to be updated.

Here is my problem.... When I do this to an account share I get an error that says: "Message: insufficient access rights on cross-reference id Status code: 26ID"

The data that I am sending is: Created Clone AccountShare [AccountId:00130000001JQtLAAW] [UserOrGroupId:00530000000cOyXAAU] [AccountAccessLevel:All] [OpportunityAccessLevel:Edit] [CaseAccessLevel:Edit]

I'm logged in with full admin rights.

Any Ideas?

Cheers;
GlennW

benjasikbenjasik
When creating AccountShare's via the API, you are creating manual shares. When you insert a account and you are in a non-public model, the owner row is automatically inserted for you.

I think the problem is that you are setting AccountAccessLevel to All. This is only possible for the owner row, which you cannot insert. The maximum access you can grant via a manual share is Edit

You only want to be moving AccountShares where the rowCause is Manual. Are you are using AccountTeams as well?

It's a bug that we're returning insufficient access rights on cross-reference id. I'll log that
GlennWGlennW

So..... If I'm attempting to merge two accounts together (and the user wants to merge accountShares) only the ones with Reason="Manual Sharing" should be cloned?

Cheers;
GlennW

benjasikbenjasik
Yes. The owner row will occur when you insert the account. Any parent implicits will occur if you are in a private account model and you have opportunities or cases associated with the account owned by a user other than the account owner. Rule shares are applied automatically. AccountTeam shares occur when you add a account team member to the account.