Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Customize the work order state transition map

Customize the work order state transition map

Users with the system administrator role can customize the work order state transition map, which maps work order states to project task states.

Updating the state of a work order also updates the state of the linked project task. The FieldServicesProjectTaskStateHandler script maps the work order states to the project task states. Users with the system administrator role can customize this state transition map as needed based on the following examples.

Examples

Setting the status of a work order to Close complete should not close the project task. To make this change, remove the following line in the initialize() function:
this.workOrderProjectTaskStateMap[FieldServiceProjectTaskStateHandler.WORK_ORDER_STATE_CLOSE_COMPLETE] =
      FieldServiceProjectTaskStateHandler.PROJECT_TASK_STATE_CLOSE_COMPLETE;
    
To map the work order Pending dispatch state to the project task Open state, add the following line to the initialize() function:
    this.workOrderProjectTaskStateMap[FieldServiceProjectTaskStateHandler.WORK_ORDER_STATE_PENDING_DISPATCH] = FieldServiceProjectTaskStateHandler.PROJECT_TASK_STATE_OPEN;
    

To qualify a task automatically once the project task is changed to Open, change the FieldServiceProjectUpdateHandler process function that listens on project task updates and change the linked work order to Qualified. Add the following line after this section:

if(taskJSON.change_map && taskJSON.change_map.state){
    If(taskJSON.change_map.state == FieldServiceProjectTaskStateHandler.PROJECT_TASK_STATE_OPEN
    workOrder.state = FieldServiceProjectTaskStateHandler. WORK_ORDER_STATE_PENDING_DISPATCH
    workOrder.update();
    

This site is scheduled for a small content update on Tuesday, December 18th, between the hours of 4:00pm and 8:00pm Pacific Time (Dec 19 00:00 – Dec 19 4:00 UTC). Access to this site may be slightly delayed during that time.