How to change process formatters based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2016 11:55 PM
Hi All,
In my change form I have different states for type routine & emergency. So i need to change the process flow which are displayed on top of the form. can we hide those based on condition or based on views. I need those process flows to get changed based on the type the change is. Please help me where the condition needs to be built?
Thanks,
Tony
- Labels:
-
Change Management
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2017 04:03 AM
This ServiceNow Share should do what you are wanting, it adds a separate view condition to the process flow formatter and makes it dynamic. Works well.
Looking at the comments minor adjustments needed for Helsinki, but all documented in the discussion.
Regards
Paul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2018 01:40 PM
To stay within OOB functionality, the process flow applies to the table [change_requests]. You cannot have a different process flow for different views as each of your views is still based on the table [change_requests]. The conditions you specify for each entry in the Process Flow only control when that entry is highlighted in the Process Flow at the top of the screen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2019 04:49 AM
Hi tonystark,
Write a Business rule on Change Request(change_request) table
When to run:display
Order:1
In advanced add the script.
To check for the type of the Change Request
var typ=current.type.toString();
if(typ=='standard')
To make a stage in Process Flow inactive or remove:
Query 'sys_process_flow' table with 'label =<label name>'
And make that particular stage false.
var flow=new GlideRecord('sys_process_flow');
flow.addQuery('label','Assess');
flow.query();
if(flow.next())
{
flow.active=false;//make assess stage false
flow.update();
}
To change the order of the flow formatter:
Query 'sys_process_flow' table for 'active = true' condition
Check for the label and assign the order .
var floworder=new GlideRecord('sys_process_flow');
floworder.addQuery('active',true);
floworder.query();
while(floworder.next())
{
if(floworder.label=='Assess')
{
floworder.order='200';
}
if(floworder.label=='Scheduled')
{
floworder.order='300';// order changed
}
if(floworder.label=='Implement')
{
floworder.order='500';//order changed
}
if(floworder.label=='Authorize')
{
floworder.order='400';//order changed
}
floworder.update();
}
So each time Standard change is opened , the process flow formatter order changes.
Make sure to add another condition to keep Process flow formatter default and all the stages active for other Change Request Types.
if(typ=='emergency'||typ=='normal')
{
var globalFlow=new GlideRecord('sys_process_flow');
globalFlow.addQuery('label','Assess');
globalFlow.query();
if(globalFlow.next())
{
globalFlow.active=true;
globalFlow.update();
}
var globalFloworder=new GlideRecord('sys_process_flow');
globalFloworder.addQuery('active',true);
globalFloworder.query();
while(globalFloworder.next())
{
if(globalFloworder.label=='Assess')
{
globalFloworder.order='200';
}
if(globalFloworder.label=='Authorize')
{
globalFloworder.order='300';
}
if(globalFloworder.label=='Scheduled')
{
globalFloworder.order='400';
}
if(globalFloworder.label=='Implement')
{
globalFloworder.order='500';
}
globalFloworder.update();
}
}
If this is correct please mark helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2019 11:55 AM
HI,
Did you find an answer for this? I want to have two different process flows on sc_req_item table based on conditions