Process Flow in Scoped Application

LdR
Tera Expert

Hello everyone,

I noticed that in a scoped application with a Flow Formatter for the states, everything before the current state is checked as complete, even if some of these states are skipped.

To a bettere explaination of my problem, I attach an example.

In this example, we switched directly from "Waiting to approve" state to "Approve", but "Pending info" is checked anyway: find_real_file.png

Is that the currect behavior of FF?

If yes, there is any way to modify that behavior to uncheck the skipped states? 

Thank you all for attention.

7 REPLIES 7

Nikhil Dixit
Giga Expert

Hi there,

You might need to create a custom process flow in which you will require to control the display of flow formatter steps based on either views.

Create the formatter after creating the UI macro that defines the content.

With the UI macro in place, create the formatter that references it, and add it to the form.
  1. Navigate to System UI > Formatters.
  2. Click New.
  3. In the Name field, enter a descriptive name for the formatter.
  4. In the Formatter field, enter the name of the UI macro with .xml appended to it.
  5. In the Table field, select the table in which the formatter will be used.
  6. In the Type field, select Formatter.
  7. Click Submit.
  8. To add the formatter to a form, configure the form.
    The formatter appears on the form according to your selections.

 

Regards,

Nikhil Dixit

find_real_file.png

www.DxSherpa.com

Hello Nikil,

 

I am looking for same functionality, please tell us to which UI Macro exactly we want to consider for flow formatters.

Hi @Nikhil Dixit I have followed the above steps and see an error on the form screen as below "GlideController is not allowed in scoped applications" and no states are displayed on the process flow.

UI Macro:

<?xml version="1.0" encoding="utf-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null" trim="false">
	<g2:evaluate var="jvar_flows" jelly="true" object="true">
        var flows = null;
        var functionName = current.getRecordClassName() + "_ProcessFlowList";
        var func = GlideController.getGlobal(functionName);
         if (typeof func == 'function') {
            flows = func();
        }
        flows;
	</g2:evaluate>
	<j2:if test="$[jvar_flows == null]">
		<g2:flow_formatter var="jvar_flows" table="$[${ref_parent}.getRecordClassName()]" current="$[${ref_parent}]"/>
		<j2:set var="jvar_flow_size" value="$[jvar_flows.size()]"/>
	</j2:if>
<tr><td>
	<ol tabindex="0" class="process-breadcrumb process-breadcrumb-border">
		<j2:forEach items="$[jvar_flows]" var="jvar_flow" indexVar="jvar_index">
			<j2:set var="jvar_flow_step" value="$[jvar_index + 1] ${gs.getMessage('of')} $[jvar_flow_size]"/>
			<j2:choose>
				<j2:when test="$[jvar_flow.getParameter('state') == 'current']">
					<j2:set var="jvar_flow_class" value="active"/>
					<j2:set var="jvar_flow_stage" value="${gs.getMessage('Current stage')}"/>
				</j2:when>
				<j2:when test="$[jvar_flow.getParameter('state') == 'past']">
					<j2:set var="jvar_flow_class" value="completed disabled"/>
					<j2:set var="jvar_flow_stage" value="${gs.getMessage('Previous stage')}"/>
				</j2:when>
				<j2:otherwise>
					<j2:set var="jvar_flow_class" value="disabled"/>
					<j2:set var="jvar_flow_stage" value="${gs.getMessage('Next stage')}"/>
				</j2:otherwise>
			</j2:choose>
			<li class="$[jvar_flow_class]" data-state="$[jvar_flow.getParameter('state')]">
				<a href="javascript&colon;void(0);" tabindex="-1" role="presentation"
				   aria-label="$[jvar_flow_stage] $[jvar_flow.getLabel()] $[jvar_flow_step]">
					$[jvar_flow.getLabel()]
				</a>
			</li>
		</j2:forEach>
	</ol>
</td></tr>
</j:jelly>

Error on the screen:

Hari1_0-1677309497944.png

Please help. Thanks.

Chuck Tomasi
Tera Patron

What you see is the current behavior of the process flow formatter. It has always behaved that way. The intended use case is for linear processes that move forward. Jumping around back and forth, or skipping over steps is not supported at this time.

 

I invite you to open an enhancement request! Our product managers DO listen.

Enhancement requests: Tell us how you would improve the ServiceNow product 

 

If you require only states that have been covered, you are going to need to create your own solution of a formatter using a UI macro, a table to track which states have been hit/skipped for a specific record, etc. It could be quite complex and custom - meaning it would be rather expensive to create, maintain, and upgrade. I don't recommend it.