5

As per this link and this one, if a contract has a status that is under the 'Activated' contract status category, the account name of that contract cannot change. This is a problem and I would argue it is a bug.

An idea has been open since 4 years to rectify this, however it looks like this issue won't be addressed soon.

Let's say I have contract A that is under Account 1, and contract A should actually be under Account 2 but it cannot be edited because contract A has a category of 'Activated'.

How can I rectify contract A so that it does indeed fall under Account 2? I was looking at cloning contract A via the .clone(true, true, true, true) method and then doing an update but this isn't working because the 'ENTITY_IS_LOCKED' error msg is being returned still*.

Besides from cloning the contract from scratch, is there a way around this? (it isn't ideal to clone a contract because the id and auto-number will be different).

*For example,

Contract c = [select id from contract where id = 'ABCDEFGHIJ']; 
Contract cCopy = c.clone(true, true, true, true);
cCopy.accountId = '0012233445566'; 
update cCopy;
system.debug('@@@@@@@' + ' ' + cCopy.id);

1 Answer 1

2

I have found out from Premier Support that unfortunately this is not possible. Premier Support advise that this is not a bug, this is standard functionality that the Account.Id is locked once the Contract has been Activated.

All fields on the Contract record are editable except the Account, it cannot be re-parented.

Although the aforementioned Ideas and this one here are either 'Under Consideration' or 'Under Point Threshold', these Ideas aren't yet explicitly on the road-map.

The 'workaround' is far from ideal because:

  1. of the work involved (cloning a record, with all related child records)
  2. you cannot specify the recordId (so if you have external systems/spreadsheets which reference an Activated contract, you can't clone that Activated contract with the same recordId)
  3. the Contract History will be lost as the cloned contract record will have its own contract history (I don't think there is any App from the AppExchange which supports cloning the record history).

The best workaround that I see is:

If you have a contract number '840' that is activated, and you want to clone '840'...

  1. You can leverage the Apex class here
  2. Edit the Contract AutoNumber field to '840'
  3. Go to Workbench and go to 'Apex Execute'
  4. Run the Database.query method (ensure any unwanted email alerts on the contract object are de-activated first)
  5. Clone the contract (will need to add a line to ensure the cloned contract has a status which is under the category of 'Draft'
  6. Insert the cloned contract Go back to the Contract AutoNumber field and revert it back to what it originally was, so that there are no duplicate contract numbers
  7. Delete the original contract
  8. Good idea: add yourself to a permission set which enables you to the system permissions 'Set Audit Fields upon Record Creation' and 'Update Records with Inactive Owners' and add a line in step 4. to say that the cloned contract matches the createddate, createdby, lastmodifieddate and lastmodifiedbydate values of the original.

Another alternative would be to look at 'Clone' apps on the AppExchange and also this fantastic link here by a developer who create a 'Deep Clone' function via a button which enables you to clone all records in a child relationship from that contract.

If you are a Premier Support customer, you can get them to do such changes for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.