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
alivepjcalivepjc 

AJAX update contract status

Hi,

I need to update the status of a contract, but I don't quite understand how it works.
There's the ContractStatus table and the Contract table with Status field and StatusCode field. I am using AJAX.

//--------------------------------------------------------
var contract_object_update = new DynaBean("Contract");

contract_object_update.set("Id",Contract_id);

contract_object_update.set("StatusCode","???"); // ?

contract_object_update.set("Status","???"); // ?

Contract_to_Update.push(contract_object_update);

var sr = sforceClient.Update(Contract_to_Update)[0];
//---------------------------------------------------------

Thanks!
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.

[... 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.