GlideController not working in Scoped Application

Hari1
Mega Sage

Hi,

I have created a scoped table and have the process flow configured but when I skip the states and moved from 1 state to another. All the skipped state also is checked as completed. I do not want this to happen. I am using the below UI Macro. But see an error on the form screen as  "GlideController is not allowed in scoped applications". 

 

Below is the script for 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>

If I skip state - "Pending info" it still is checked as completed. I need to skip this step as I have not taken it.

Hari1_0-1677308293107.png

 

 

4 REPLIES 4

Sai Kumar B
Mega Sage
Mega Sage

@Hari1 

 

You can do one thing, Place the GlideController() logic in the Global script include, and call the Global script include using the API name in your UI macro code.

If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B
Community Rising Star 2023 & 2022

Hi @Sai Kumar B Can you please provide an example on how can we call the Global script include using the API name in the UI macro code? Thanks

@Hari1 

You can use the following format to call the Global script include in Scoped application

1.) Create a script include and set Accessible from as All Application Scopes

2.) Call the script include as below in the UI Macro code

 

new global.sciptIncludeName().functionName(); 

 

If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B
Community Rising Star 2023 & 2022

Allen Andreas
Administrator
Administrator

Hi,

This has been asked for a few times, but the process flow formatter is meant to show a linear process where the steps are followed in that order. I don't know if you get the GlideController issue resolved, if your script will work as you want. Did you customize it beyond just accounting for the states? Because all of the out of box macros do the same thing (checkmark all previous states up to and including the current state). Without those states being captured somewhere (like audit log, etc.) it's not going to know you skipped a state.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!