Develop > Document Engine > Work order example overview > Modify im.set.close Process definition

Modify im.set.close Process definition

This process needs to be modified so that a user cannot close an incident if there are work orders still open for the incident.

To modify a process definition record, follow these steps:

  1. From the System Navigator, click Tailoring > Document Engine > Processes to open the Process Definition form.
  2. Type im.set.close in the Process Name field.
  3. Click Search.
  4. On the Initial Javascript tab, type the following JavaScript:

    var WO=new SCFile ("EXWorkOrder")
    var FoundOpenWO=WO.doSelect ("RelatedID=\""+system.vars.$L_
    file.number + "\""+" and status ~=\"" + "Closed" + "\""
    if (FoundOpenWO == RC_SUCCESS)
    {
    system.vars.$openWO=true;
    }
    else
    {
    system .vars.$openWO=false;
    }
  5. Click Save.
  6. On the RAD tab, enter the following information:

    Field Value
    Note: Some of the fields on the RAD tab are pre-filled with values that you do not need to modify
    RAD Application - Select the empty section below the section calling the RAD Application us.consume.wrapper and then enter the following information:
    Expressions evaluated before RAD call $L.text="There are still open work orders. This incident cannot be closed yet."
    RAD Application apm.mb.ok
    Condition $openWO=true
    Parameter Names text
    Parameter Values $L.text
  7. Click Save.
  8. On the Final Expressions tab, enter the following information:

    • if ($openWO=true) then ($L.exit="badval")
    • $L.exit="closestate"
  9. Click Save and then OK.