Skip navigation
All People > SupratikUBS > Supratik Dutta's Blog > 2018 > December > 09

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 

Sometimes we require to run a Java Job in CAPPM using a gel script where we can change the parameters of the job on run time.


This can be achieved by a small code snippet which runs the XBL Executor in Gel and passes the parameter to the job.


The code goes here:


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

<core:catch var="excp">
<gel:parse var="inputDoc">

<!--job_name you can give any meaningful name and job_definition_id has to be the id of the job you want to run -->
<job job_name="Delete Process Instance-Supratik(Port Sync Java)" job_definition_id="50420" job_definition_type="JOB" recurrence_type="4" whenNow="1" whenRecur="1" />

<!-- Put the bind parameter code from the Job Definition pass the value in the similar format mentioned below-->
<param_process_name value="Portfolio Sync from Java"/>




<core:new className="com.niku.odf.object.xbl.XBLExecutor" var="xblInstance">
<core:arg value="scheduler/postSchedulerProperties.xbl"/>
<core:arg value="nmc"/>
<core:arg value="${inputDoc}"/>
<core:invoke method="executeXBL" on="${xblInstance}" var="responseDoc"/>
<gel:log>Response Doc : <gel:expr select="$responseDoc"/> </gel:log>


Thanks and Regards,



Kindly comment if you find it useful.