function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MaumanMauman 

AccountShare: bad field names on insert/update call: AccountId

I am attempting to move sharing rules from one account to another, but when my code (in Java) runs, I get the following error:

Code: INVALID_FIELD_FOR_INSERT_UPDATE

Message: bad field names on insert/update call: AccountId

Here is my code (in Java using the code generated by Axis and our enterprise wsdl file, and using the 2.5 API):

- - - - -

    public SaveResult[] moveAccountSharingRules(ID po_share_id, ID po_to_account_id)
         throws RemoteException
    {  
         AccountShare updateAccountShare = new AccountShare();
         updateAccountShare.setId(po_share_id);
         updateAccountShare.setAccountId(po_to_account_id);
  
         SObject[] o_obj = new SObject[] { updateAccountShare };
  
         return go_conn.update(o_obj); 
    }

- - - - - -

Am I just not allowed to move sharing rules from one account to another?  Or is there some other possible reason?

FYI, I am doing this because a subset of our accounts were imported twice into Salesforce.com with separated sets of sharing rules that we now need combined, and duplicates removed.

 

 

Message Edited by Mauman on 12-19-2003 10:17 AM

DevAngelDevAngel

Hi Mauman,

According to the describe call, the AccountId on the AccountShare object is not updateable.  To "modify" this record, I would retrieve the data for the record and use that to create a new record, replacing the old account id with the new, and then delete the old account share.

Cheers

irisiris

I also get the error message "bad field names on insert/update call: AccountId" on the Case object. I'm trying to create a new case with an accountID and contactID. Setting the contactID is fine but on setting the accountID, I get the above error message. I'm not sure what I'm missing here.

thanks,

iris