Submitting a Timesheet for Approval

In the case below, the following timesheet submission rules have been configured. When submitting a timesheet (in this example, with timesheet ID 45), if any warnings occur, (for example, if the minimum number of hours on the timesheet is less than 10), the submit call from the script would fail. If you want the submit call to occur despite the warnings, you would need to pass the “ignore_warnings” attribute as shown in the code example below.

Timesheet submission rules in OpenAir Administration module.
          function main(type) {

     // Create the approval object
     var approvalObj = new NSOA.record.oaApproval();
     approvalObj.notes = "submit from scripting";

     // Prepare the record for submit
     var timesheetToProcess = new NSOA.record.oaTimesheet();
     timesheetToProcess.id = 45;

     // Ignore any warnings
     var ignore_warnings = {
          name : "submit_warning",
          value : "1"
     };

     // Define the submit requests
     var requests = [{
          submit: timesheetToProcess,
          attributes: [ignore_warnings],
          approval: approvalObj
     }];

     // Invoke the action call
     var results = NSOA.wsapi.submit(requests);

} 

        

See also: