Cascade Request Approval to Request Item - BR , Approval activity issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 04:13 AM
I am having issue with Approval activity after Helsinki upgrade from Eureka.
- Workflow Approval activity not passing even after RITM approval is Approved/Rejected
- REQ state changing to Approved/Rejecting but it not cascading the state change to RITM.
- If we change RITM approval to Approved/Rejected - Workflow passing the Approval activity.
Any one faced this after Helsinki upgrade from Eureka ?
An another question below in Cascade Request Approval to Request Item - BR -- Why we are setting Approval of RITM as requested as per this BR???
-----------------------**************************************------------------------
/**
* The Request has been approved, rejected or cancelled. Propogate this state
* change down to the request items.
*/
cascadeRequestApproval();
function cascadeRequestApproval() {
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while (gr.next()) {
// We handle this differently for delivery plans vs. workflows
if (gr.cat_item.workflow && !gr.cat_item.workflow.nil())
cascadeRequestApprovalWorkflow(gr);
else
cascadeRequestApprovalDeliveryPlan(gr);
gr.update();
}
}
/**
* Cascade the request approval to the request item:
*
* approved -> if item is waiting for approval, get first stage of the delivery plan
* rejected -> mark item as Request Cancelled
*/
function cascadeRequestApprovalDeliveryPlan(gr) {
if (gr.cat_item.delivery_plan.nil())
return;
gr.approval = current.approval;
if (gr.stage == "waiting_for_approval" && current.approval == "approved")
gr.stage = getNextStage(gr);
else if (current.approval == 'rejected')
gr.stage = 'Request Cancelled';
}
function cascadeRequestApprovalWorkflow(gr) {
if (gr.stage == "waiting_for_approval" && current.approval == "approved") {
gr.approval = "requested"; // --------------------------------------------------------------------------->Why we are setting Approval of RITM as requested as per this BR???
gr.stage = "request_approved";
} else if (current.approval == 'rejected') {
gr.approval = "rejected";
gr.stage = "Request Cancelled";
}
}
function getNextStage(reqitem) {
// return the first delivery task
var nextStage = "nothing";
var planID = Packages.com.glideapp.servicecatalog.DeliveryPlan.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;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2016 09:23 PM
Issue is not with the above BR.
This issue has fixed after below changes in "SNC - Run parent workflows (Approval)" Business Rule.
- //new Workflow().runFlows(gr, 'update'); ---------------------------------->>>*** Commented this method*** (not sure this is how in Eureka or its our customized)
new Workflow().broadcastEventToCurrentsContexts(gr, 'update', null); ------------------------->>> *** Added This Method*** (Helsinki OOB)