AnsweredAssumed Answered

Locking Start Date of multiple projects via system action in one script

Question asked by giriraj.gupta1 on Apr 29, 2017
Latest reply on May 4, 2017 by giriraj.gupta1


I have made a object base process which locks the Start date and calling it in another non-object base process which triggers this process multiple times to lock start date of multiple projects. I am calling process(Start date lock) in for loop based on object id fetched from sql query. 


This process is running fine without any issues and able to lock start date of multiple instances in single script.


Could you please review this code and let me know it causes any issue? I don't want to lock start date via DB script.


<gel:script xmlns:SOAP-ENV=""

<gel:setDataSource dbId="niku"/>

<!-- Take the target processCode as a parameter -->
<gel:parameter var="processCode"/> <!-- Object based process which having a system action to lock Start date -->

<!-- we will launch the next process as admin to avoid rights issues -->
<core:set var="targetUserId" value="1"/>


<!-- Make sure we've supplied the processCode parameter -->
<core:when test="${processCode != null &amp;&amp; processCode.length() &gt; 0}">

<sql:query var="results">
SELECT process_version_id,
bpm_def_processes bdp,
bpm_def_process_versions bdpv,
bpm_def_objects bdo
WHERE bdpv.process_id =
and bdo.pk_id =
and bdp.process_code = ?
and (bdo.is_system = 0 or bdo.is_system is null)
<sql:param value="${processCode}"/>

<!-- Extract the process_version_id, targetObjectKey from the query -->
<core:set var="targetProcessId" value="${results.rows[0].process_version_id}"/>
<core:set var="targetObjectKey" value="${results.rows[0].object_name}"/>


<sql:query var="Project_id">
Select id from inv_investments where...<!-- query to get project DB instance id where start date needs to be locked-->

<core:forEach items=project_id.rowbyindex var="result">
<core:set var="ProjectId" value="${result.rows[0]}"/>

<!-- Here i am running a proess which locks the start date of a project -->
<core:when test="${targetProcessId != null}">
<bpm:startProcess processVersionId="${targetProcessId}" initObjectKey="${targetObjectKey}" initObjectId="${ProjectId}" initUserId="${targetUserId}"/>


<gel:log level="ERROR">Cannot find process code '${processCode}' to launch. </gel:log>



<gel:log level="ERROR">processCode parameter has not been supplied</gel:log>