Skip to main content

Updating the Sales Agreement status from 'Draft' to 'Approved' in the Apex Test Class...

>>>

        SalesAgreement oppt = new SalesAgreement(Name = 'SalesAgreement',AccountId = a.Id,PricebookId = stdPb.Id,StartDate = Date.today(),Status = 'Draft', ScheduleFrequency='Monthly', ScheduleCount=12,AgreementType='Volume');

        insert oppt;

        SalesAgreementProduct oli = new SalesAgreementProduct(Name='Product',SalesAgreementId = oppt.Id,PricebookEntryId = pbeS.Id,InitialPlannedQuantity =12,SalesPrice = 10000);        

        insert oli; 

        update oppt;

        oppt.Status = 'Approved';

        update oppt; 

>>>

 And received the error below...

System.DmlException: Update failed. First exception on row 0 with id 0YA8a000000TS1eGAG; first error: UNKNOWN_EXCEPTION, Save other edits before changing the status.: [Status]

 

Does anyone know how to fix it?

13 answers
0/9000