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

Test class: Activate a contract

Hi all,


does anyone knows how to activate a contract in a test-class?





Best Answer chosen by Admin (Salesforce Developers) 

I've received an answer to this:

first create the contract in "draft", then set it to "activated";


    Contract contract02 = new Contract(RecordTypeId = RT.Id, AccountID = acc.Id, Status = 'Entwurf');
    insert contract02;
    contract02.Status = 'Aktiviert';
    update contract02;