Process Flow formatter conditions

Stacy1
Mega Guru

Hello,

I have created a process flow for Release.   Our releases have 2 different flows depending on if the product is an application or an operating system.   In my process flow I have put the condition of product.product_type is operating system but it still shows on my releases where the product.product_type is an application.

I do not see that I can create a UI Policy on process flows.

Does anyone have any thoughts on how I can have it only show based on my product type.

Thank you,

Stacy

This screen shot is a release where the product is an application, it should not be showing here:

find_real_file.png

1 ACCEPTED SOLUTION

Deepak Ingale1
Mega Sage

Unfortunately, process flow formatter shows all the process steps irrespective of the conditions given. The only thing is, it highlights a particular process step when condition matches.



You might want to create a custom process flow in which you will require to control the display of flow formatter steps based on either views.We had created separate form view to drive this.


View solution in original post

15 REPLIES 15

Deepak Ingale1
Mega Sage

Unfortunately, process flow formatter shows all the process steps irrespective of the conditions given. The only thing is, it highlights a particular process step when condition matches.



You might want to create a custom process flow in which you will require to control the display of flow formatter steps based on either views.We had created separate form view to drive this.


Hi Deepak,

 how to create a custom process flow in which you can control the display per Form view ?

Vishwas Hegde
Tera Contributor

We had similar situation and came across a solution for the same.

 

Create anew field on sys_process_flow table (u_view_condition) with data type as condition and dependent field with table.

 

Update your UI Macros (OOB) - process_flow

 

<?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">

<![CDATA[
var afterCurrent = false, result = [], gr = new GlideRecord('sys_process_flow');
gr.addQuery('table', current.sys_class_name);
gr.orderBy('order');
gr.query();
while(gr.next()){
if(GlideFilter.checkRecord(current, gr.u_view_condition) && +gr.getValue('active') == 1){
var item = { label: gr.getValue('label') };
if(GlideFilter.checkRecord(current, gr.condition)){
item.state = 'current';
afterCurrent = true;
} else {
item.state = afterCurrent ? 'future':'past';
}
result.push(item);
}
}
result;
]]>
result;
</g2:evaluate>


<!-- test - ${jvar_flows} -->

<j2:if test="$[jvar_flows == null]">
<g2:flow_formatter var="jvar_flows" table="$[${ref_parent}.getRecordClassName()]" current="$[${ref_parent}]"/>
</j2:if>
<tr><td>
<ol class="process-breadcrumb process-breadcrumb-border" role="listbox">
<j2:forEach items="$[jvar_flows]" var="jvar_flow">
<g2:evaluate jelly="true" var="jvar_label" object="true" expression="jelly.jvar_flow.label">
</g2:evaluate>
<g2:evaluate jelly="true" var="jvar_state" object="true" expression="jelly.jvar_flow.state">
</g2:evaluate>


<!-- state $[jvar_label] -->

<j2:choose>
<j2:when test="$[jvar_state == 'current']">
<j2:set var="jvar_flow_class" value="active"/>
</j2:when>
<j2:when test="$[jvar_state == 'past']">
<j2:set var="jvar_flow_class" value="completed disabled"/>
</j2:when>
<j2:otherwise>
<j2:set var="jvar_flow_class" value="disabled"/>
</j2:otherwise>
</j2:choose>
<g2:set_if var="jvar_step_status" test="$[jvar_state == 'current']" true="step" false="false" />
<li class="$[jvar_flow_class]" data-state="$[jvar_state]" aria-current="$[jvar_step_status]" role="option" aria-selected="$[jvar_state == 'current']">
<a href="javascript:void(0);" role="presentation" aria-label="$[jvar_label]">$[jvar_label]</a>
</li>
</j2:forEach>
</ol>
</td></tr>
</j:jelly>

I need help with this statement:

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

current refers to the record that the formatter is on, correct?

and what do you have in gr.u_view_condition?

I need to show a process flow formatter on my form if x_dr_state == 'New'

AND

view is (myCustomView)

for example.

I think i need a field on sys_process_flow of type condition, u_view_condition,

with a value " view == myCustomView"   

HOW do i code or configure that last field value?