Validating and Activating CA PPM processes using Gel Script

Blog Post created by SupratikUBS on Dec 9, 2018

We often after a release in our project push many gel scripts to a live environment and we need to validate and activate the processes which got released  from the front end.

It at times become a tedious job when the number of such processes are quite a few you need to validate and activate those.


A simpler way can be to keep the list of processes in an excel workbook and run a gel script on that to validate and activate the processes one by one.


A small snippet to validate and activate a process in CA PPM directly by the use of a Gel Script is as follows:


<gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:util="jelly:util" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soap-env="" xmlns:sql="jelly:sql" xmlns:xog="" xmlns:xsi="">

<!-- GEL Script

v01 - Supratik Dutta -
<core:catch var="err">
<gel:setDataSource dbId="niku"/>
<gel:parameter var="process_code" default="supratiktest"/>
<sql:query escapeText = "false" var="process_ver_id">
<![CDATA[Select id process_version_id
from bpm_def_process_versions where process_id=(Select id from
bpm_def_processes where process_code=?)]]>
<sql:param value="${process_code}" />
<!-- get security ID -->
<core:invokeStatic className="com.niku.union.utility.UtilityThreadLocal" method="getSecurityIdentifier" var="utlSecID" />
<!-- get BPM Context -->
<core:invokeStatic className="com.niku.bpm.engine.persistence.BpmContext" method="getContext" var="bpmContext" >
<core:arg type="boolean" value="true"/>

<core:invoke method="getConnection" on="${bpmContext}" var="conn"/>
<core:invoke method="getSchemaName" on="${bpmContext}" var="schemaName"/>
<core:invoke method="getVendor" on="${bpmContext}" var="dbVendor"/>
<!-- get Validation Context -->
<core:new className="com.niku.bpm.validator.ValidationContext" var="validationContext">
<core:arg type="" value="${utlSecID}" />
<core:arg type="java.sql.Connection" value="${conn}" />

<core:invoke method="setSchemaName" on="${validationContext}" var="SchemaName">
<core:arg type="java.lang.String" value="${schemaName}" />

<core:invoke method="setVendor" on="${validationContext}" var="VendorName">
<core:arg type="" value="${dbVendor}" />
<!--Pass the Process Version ID which needs to be validated and activated-->
<core:invokeStatic className="com.niku.bpm.defobjects.DefinitionPersistenceUtils" method="getProcess" var="process" >
<core:arg type="long" value="${process_ver_id.rows[0].process_version_id}"/>
<core:arg type="com.niku.bpm.engine.persistence.BpmContext" value="${bpmContext}" />
<!--Invoke the Validate process method-->
<core:invoke method="validate" on="${process}" var="processvalidate">
<core:arg type="com.niku.bpm.validator.ValidationContext" value="${validationContext}" />
<sql:query escapeText = "false" var="internal_status">
<![CDATA[Select internal_status_code
from bpm_def_process_versions where process_id=(Select id from
bpm_def_processes where process_code=?)]]>
<sql:param value="${process_code}" />
<core:set var="status_out" value="BPM_PIS_VALIDATED"/>
<core:if test="${status_out.equals(internal_status.rows[0].internal_status_code.toString().toUpperCase().trim())}">
<core:invoke method="activate" on="${process}" var="processactivate">
<core:arg type="com.niku.bpm.validator.ValidationContext" value="${validationContext}" />



Thanks and Regards,

Supratik Dutta


Kindly provide your feedback if you find this blog useful.


And Happy new year in advance