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
margotqmargotq 

Activating a Contract via the API

I am having difficulties activating a contract through the API. The documentation says to first create the contract in a non-activated status, which I am doing and which works. The documentation then says to change the 'Status' value of the contract to an activated status in order to activate.

When I try to change the status value to either the name value ("Activated") or the Id for the status from the ContractStatus set, I get the following error:

"invalid cross reference id"

If anyone has activated contracts before, some insight would be very helpful.

Thank you,
Margot
Ron HessRon Hess
contract status is dependent on the approval process, so as an example

when you create a new approval request, the staus of the contract will be updated.
// ajax

[... populage a new contract object ..]
var saveResult = sforceClient.Create([newContract]); // create new contract
var newRecordID = saveResult[0].id;

var newApproval = new Sforce.Dynabean("Approval"); // move into the "review" stage by adding an approval
newApproval.set("ParentId",newRecordID);
newApproval.set("Status","Pending");

var saveResult = sforceClient.Create([newApproval]);


now, you can see the contract stage has been updated by the act of adding an approval request.
margotqmargotq
Thanks Ron.

Is it necessary to create an approval request before it is possible to "activate" a contract? Via the interface I can immediately activate a contract and bypass the approval steps.

I am simply trying to turn a non-activated contract into an activated one, and all of the documentation I am reading says that changing the contract's status directly should affect activation...
SuperfellSuperfell
Are you sure the update to change the status to activated, only includes the Id and the activated flag ?
Ron HessRon Hess
sorry, i misunderstood your question, will have to look into it.
margotqmargotq
Actually, SimonF's post helped me diagnose the problem. Along with setting the ID and the Status values, I was also trying to set the StatusCode value. By removing this third part, I was able to change the status correctly (to one of the 'Activated' statuses), and the contract was activated.

Thanks for your help.