Notifications

573 views

Description

When a run script activity in a Service catalog workflow adds a new req_item to the parent request, the workflows for the rest of the items in the request do not start. The Items Added After Request Approved business rule redefines a method needed in the Cascade Request Approval to Request Item business rule.

Steps to Reproduce

 

  1. Use the attached sys_remote_update_set_279a2f62533303004679d9109ec5876b.xml update set.

  2. Navigate to Service Catalog > Office > Services.

  3. Select TD 1.

  4. Add a TD 1 to the cart.

  5. Add a second TD 1 to the cart.

  6. Proceed to Checkout.

 

 

Workaround

  1. Edit the Items Added After Request Approved business rule on sc_req_item so that the script is as follow:

    /**
     * If items are added after the request is set to 'approved' ensure the stage and approval fields are set correctly
     * and that the workflow will be attached through invoking the 'Start Tasks' business rule.
     * Designed to work with the 'Add New Item' UI Action on sc_request.
     * Not designed to work if a new item is added manually. such as enabling the new button on the 'Requested Items' related list.
     */
     
    setApprovalFields();
     
    function setApprovalFields() {
       // We handle this differently for delivery plans vs. workflows
       if (current.cat_item.workflow && !current.cat_item.workflow.nil()) {
          current.approval = "requested";
          current.stage = "request_approved";
       } else {
          current.approval = current.request.approval;   
          current.stage = getNextStage(current);
       }
    }
     
    function getNextStage(reqItem) {
       // return the first delivery task
       var nextStage = "nothing";
       var planID = GlideappDeliveryPlan.resolvePlanID(reqItem);
       var gr = new GlideRecord("sc_cat_item_delivery_task");
       gr.addQuery("delivery_plan", planID);
       gr.orderBy("order");
       gr.query();
       if(gr.next())
          nextStage = gr.name.getDisplayValue();
       
       return nextStage;
    }
    
  2. Remove the customer update for the record so that the customer will receive future upgrades to that BR.

 


Related Problem: PRB1249697

Seen In

There is no data to report.

Fixed In

London

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-02-12 10:21:50
Published:2018-02-12
PRB1249697 Repro - sys_remote_update_set_279a2f62533303004679d9109ec5876b.xml