How to customize rendering of stage completion Self-Service Requested Items or My Requests?

kristenankeny
Tera Guru

I have added a condition to an approval step to handle system cancellation of a requested item when the approval has been pending for 15 days. This image shows what the stage looks like on two different requested items, one rejected and the other cancelled.

                            find_real_file.png

Please ignore the new stages "Request Cancelled" and "Rejected", which were added so I could compare different test scenarios. The issue is when an approval is cancelled, it shows "Completed" with a green check mark. I would prefer it to say "Cancelled" and then something similar to the red X shown for rejected. You can see the same rendering when viewing the requested item from the Order Status:

find_real_file.png

Does anyone know how to customize this?

Thanks!

Kristen

1 ACCEPTED SOLUTION

kristenankeny
Tera Guru

We resolved the issue with the "Request Cancelled" stage showing a green check mark. This icon is linked to the approval status. By setting the approval status to rejected, I now see the item is cancelled with a red x.


find_real_file.png


View solution in original post

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Kristen,



Please go through the below link for more info


http://wiki.servicenow.com/index.php?title=Workflow_Stages#gsc.tab=0


HI Pradeep,



I looked through this article previously but I'm not seeing where it addresses my specific issue.



kristenankeny
Tera Guru

In case anyone else is dealing with a similar need, this is what I did in this instance:



I have a scheduled job that finds approval tasks that are a certain age (I have not activated the time on this script, it's still "On Demand"). This script I found on another community question and adjusted to my needs:


cancelOutstandingApprovals();


function cancelOutstandingApprovals(){


  var appr = new GlideRecord('sysapproval_approver');


  appr.addQuery('state','requested');


  //appr.addQuery('sys_created_on', '>', gs.minutesAgo(5));


  appr.query();



  while (appr.next()){


  appr.state = 'cancelled';


  appr.update();


  //gs.log('Approval for: ' + appr.Name,'Cancel Approvals');



  var ritm = new GlideRecord('sc_req_item');


  var doc = appr.document_id;


  //gs.log('Requested item is: ' + doc,'Cancel Approvals');


  ritm.addQuery('sys_id', doc);


  ritm.addQuery('approval', "!=",   'cancelled');


  ritm.query();



  if (ritm.next()){


  ritm.approval = 'Cancelled';


  ritm.comments = 'System cancelling request due to no response from approver within 15 days.'


  ritm.stage = 'cancelled';


  ritm.update();




  gs.eventQueue("requestitem.approval.cancelled", ritm, gs.getUserID(), gs.getUserName());


  gs.log('Cancelling task ' + appr.sysapproval.number + " as approval was not received from " + appr.approver.name,'Cancel Approvals System Job');



  }


Then, I've updated the workflow so that I have a "Cancelled" route from the approval step that Closes the Request Item as Incomplete, then rolls back to a check to see if the request item is closed incomplete. If it is, then I set a stage of "Request Cancelled":


find_real_file.png



The only remaining concerns I have with this solution is that the view for end users is confusing because it shows "Request Approved (Approved)" and then "Request Cancelled (Completed)" with a green check mark. I'm pending some feedback from our consulting company on whether either of these can be modified.


find_real_file.png


kristenankeny
Tera Guru

We resolved the issue with the "Request Cancelled" stage showing a green check mark. This icon is linked to the approval status. By setting the approval status to rejected, I now see the item is cancelled with a red x.


find_real_file.png