how change The status of expense report using suite script ?

hi, not able to change the status of “expense report” from pending or approved To REJECTED

I have used the given below script :-

loadExpenseObj=record.load({
            type:record.Type.EXPENSE_REPORT,
            id:expense_intrnl_id,
            isDynamic:true
});

loadExpenseObj.setValue({fieldId:’rejected’,value:true});
loadExpenseObj.setValue({fieldId:’status’,value:’Rejected by Script’});
loadExpenseObj.setValue({fieldId:’statusRef’,value:’ExpRept:E’});
letexpenseInternlID=loadExpenseObj.save();

Rookie Asked on October 19, 2023 in SuiteScript.
Add Comment
1 Answer(s)
Either of these should work:
loadExpenseObj.setValue({fieldId:’status’, value:3});
loadExpenseObj.setText({fieldId:’status’, text:’Rejected’});
Intermediate Answered on November 5, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor