Mark stage field with red X

jbutz
Kilo Expert

I've seen the stage updated with a red X when the workflow for a Request Item is canceled. I would like to make that X appear under a certain error condition in my workflow. Does anyone know how I can accomplish that?

 

Below is a screenshot of what I am talking about.

failed stage.png

1 ACCEPTED SOLUTION

Ok, I figured out a really easy way to do it.



I have the conditions on a catalog task for 3 closed states (Closed Complete, Closed Incomplete, and Closed Skipped). The catalog task activity is set to the stage I want to show the rejected icon on if it fails. On the Incomplete and Skipped states I have it transition to a Run Script activity. The following is the code in the Run Script. It marks the previous activity as cancelled, which causes the red x to appear.



var gr = new GlideRecord('wf_history');
if( gr.get( activity.previous_activity ) )
{
          gr.state = 'cancelled';
          gr.result = 'cancelled';
          gr.update();
}

View solution in original post

8 REPLIES 8

this code is not helping me. 

The activity is getting failed but the stage still shows completed.

 

solutioningnow
Giga Guru

Hi Jason,



You can follow below steps to achieve,



1) I would recommend to add one attribute value in the state field of Requested item saying 'Error in Workflow' or have a new field on task table.



2) Set the value of the state value = Error in workflow if there is any error on the worklow, by writing business rule on Workflow context table when state changes to Error in Workflow context record.



3) Have one more condtion in the script include 'WorkflowIconsStages' for state = Error in workfllow.



Please mark answer as correct if it was really helpful!!



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


Thanks for the suggestion, but I got it working without having to do much customization. I'll be posting my solution.


Hi Jason,



Would look for the easiest solution that you implemented without customization .



Please mark answer as Helpful/correct if it was really helpful!!



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/