NSOA.wsapi.approve(approveRequest)
Use this function to approve bookings, timesheets, invoices, and envelopes. It can take an array of up to 1,000 approve request objects.
Parameters
-
approveRequest{object} [required] — approveRequest object
Returns
Array of ApprovalResult objects.
Units Limit
-
20 units
+10 for each additional object passed
For more information see Scripting Governance.
Since
October 15, 2016
Example
In this example, the script creates the approval object, then prepares the timesheet with timesheet ID 45 for approval, defines the approve requests, and invokes the action call.
// Create the approval object
var approvalObj = new NSOA.record.oaApproval();
approvalObj.notes = "approve from scripting";
// Prepare the record for approve
var timesheetToProcess = new NSOA.record.oaTimesheet();
timesheetToProcess.id = 45;
// Define the approve requests
var requests = [{
approve: timesheetToProcess,
attributes: [], // approve attrributes are optional
approval: approvalObj
}];
// Invoke the action call
var results = NSOA.wsapi.approve(requests);
Note:
This simple example does not show error checking, see Handling Approval Errors
See Code Samples for more examples.