Can you have different Process Flow Formatter for Projects

Andrew Payze
Kilo Guru

Hi,

is there a way to show different process flow (formatter) based on a specific field?

We have different types of projects with different types of phases, like construction, IT deployments.  These have different types of phases.  A the moment we have a field that defines the types of projects and fields for the different phases.....

we know how to create the different process flow in system UI->process flow.  Is there a UI / BR / CS that can determine which process flow to display based on a specific field?

Tx

Andrew

 

1 ACCEPTED SOLUTION

sayali udgave
Kilo Guru

Hi Andrew,

 

Use UI macro  for conditional process flow formatters. In below code change according to your conditions.

<?xml version="1.0" encoding="utf-8" ?>

 

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

 

      <link rel="stylesheet" type="text/css" href="styles/process_flow_formatter.cssx"></link>

 

      <tr>

 

              <td colspan="2" width="100%" nowrap="true">

 

                      <div>

 

                              <table width="100%" cellpadding="0" cellspacing="0">

 

                                      <tr>

 

                                              <g2:flow_formatter var="jvar_flows" table="$[__ref__.getRecordClass()]" current="$[__ref__]" />

 

                                              <g2:evaluate var="jvar_elements" jelly="true" object="true">

 

                                                      var afterCurrent = false;

 

                                                      var tableText = '';

 

                                                      var show = [];

 

                                                      var label = "";

 

                                                      var gr = new GlideRecord("sys_process_flow");

 

                                                      gr.addQuery("table", current.sys_class_name);

 

                                                      gr.orderBy("order");

 

                                                      gr.query();

 

                                                      while(gr.next()){

 

                                                              //Check to see if the record should be displayed.   If so add element to array.

 

                                                              //Array info

 

                                                              //     show[] -> Each element is a flow formatter record to display

 

                                                              //           show[].label -> Label for the flow formatter to display.

 

                                                              //           show[].state -> used to indicate the state of the flow formatter.

 

                                                              //                           Possible values: past, current, future

 

                                                              //           show[].next_state -> used to indicate the state of the next flow formatter.

 

                                                              //                           Possible values: past, current, future

 

                                                              if(GlideFilter.checkRecord(current, gr.u_view_condition)){

 

                                                                      var item = new Object();

 

                                                                      item.label = gr.getValue("label");

 

                                                                      //Check if this is the current flow that should be green/selected.

 

                                                                      if(GlideFilter.checkRecord(current, gr.condition)){

 

                                                                              item.state = "current";

 

                                                                              item.next_state = "future";

 

                                                                              //Once current is found update the previous element

 

                                                                              if(show.length > 1){

 

                                                                                      show[show.length - 1].next_state = "current";

 

                                                                              }

 

                                                                              afterCurrent = true;

 

                                                                      } else {

 

                                                                              if(afterCurrent){

 

                                                                                      item.state = "future";

 

                                                                                      item.next_state = "future";

 

                                                                              } else {

 

                                                                                      item.state = "past";

 

                                                                                      item.next_state = "past";

 

                                                                              }

 

                                                                      }

 

                                                                      show.push(item);

 

                                                              }

 

                                                      }

 

                                                      //clear the next_state element so that the process flow has a pointer at the end.

 

                                                      show[show.length - 1].next_state = "";

 

                                                      if(!afterCurrent){

 

                                                              show[show.length - 1].state = "future";

 

                                                      }

 

                                                      show;

 

                                              </g2:evaluate>

 

                                              <j2:forEach items="$[jvar_elements]" var="jvar_el">

 

                                                      <g2:evaluate jelly="true">

 

                                                              var label = jelly.jvar_el.label;

 

                                                              var state = jelly.jvar_el.state;

 

                                                              var next_state = jelly.jvar_el.next_state;

 

                                                      </g2:evaluate>

 

                                                      <td nowrap="nowrap" class="process_flow $[state]" title="$[label]">

 

                                                              $[label]

 

                                                      </td>

 

                                                      <td width="16" height="100%">

 

                                                              <img style="height: 24px; width: 21px; margin: 0px; padding: 0px;" src="images/chevron_$[state]_$[next_state].pngx" />

 

                                                      </td>

 

                                              </j2:forEach>

 

                                      </tr>

 

                              </table>

 

                      </div>

 

              </td>

 

      </tr>

 

</j:jelly>

 

 

View solution in original post

10 REPLIES 10

have you been able to accomplish this?

I am trying to do the same thing and I am stuck.

Hi 

Not working yet.  I have not had time to work on it.  Plan to work on it next week

A

Hi ggg,

I did get this working.

see my screenshots above and make sure you have the same thing.  There is a UI Macro called process_flow, you need to replace the script with Saylai's and make sure you add the field u_view_condition to the sys_process_flow table (see screenshot above).  Then you need to update the records with a condition 

Andrew

 

Hey Andrew,

Did you resolve the issue of the formatter showing green in the style:find_real_file.png

Instead of the OOB style:

find_real_file.png

 

Most people who posted on the original post are having this issue, wondering if you got around it?

https://community.servicenow.com/community?id=community_question&sys_id=6a738f25dbd8dbc01dcaf3231f96...

 

@Vishwas Hegde posted an updated UI Macro script that worked for me on Orlando with the current OOB flow formatter style.

It uses the same custom condition field on the sys_process_flow table (u_view_condition).

Here's the thread: https://community.servicenow.com/community?id=community_question&sys_id=19474f29db1cdbc01dcaf3231f96...