What is  ${gel_objectInstanceId} for?

Blog Post created by Aurora_Gaimon Employee on Dec 16, 2016

For those who are new to GEL scripting, I’m pretty sure one of the first questions you may have is:

“What is  ${gel_objectInstanceId} for?”


CA PPM guide says: It’s a GEL Built-Parameter. Ok, …next question then is  … “How do I use it?”


1 . Create a process and ensure it's linked to Project object:



**Note: for demo purpose, ensure it's available for On-Demand start.




2. Add Gel Script below (you can add it in the start step):


<!-- Add libraries ...-->






<!-- get DB source -->

<gel:setDataSource dbId="niku"/>


<!-- Run SQL query to read data from DB  -->                                                                          

<sql:query escapeText="false" var="v_qryresult">

            <![CDATA[select name project_name

            ,code project_code

            from inv_investments   

            where id=?]]>  

<sql:param value="${gel_objectInstanceId}"/>



<!-- set values in variables  -->

<core:forEach items="${v_qryresult.rowsByIndex}" var="varRow">

            <core:set value="${varRow[0]}" var="project_name"/>

            <core:set value="${varRow[1]}" var="project_code"/>

            <!-- Show in UI -->

            <gel:log> Project Name is "${project_name}" and Code is "${project_code}"</gel:log>





** Note: The "?" will be replace the the parameter gel_objectInstanceId when gel script executes


Let's go to  keep it simple as below "Start-Finish", no extra steps needed.


 3. Validate and activate all.


4. Go to Project List and select a project. Click on it.


5. Go to "Processes" tab and then to "Available":



and start your processes:



6. Once process instance is completed, click on "YELLOW" flag:



7. you can see the "gel:log" message on your screen:



So, actually what happened is that gel_objectInstanceId  is actually the internal database id for that specific instance.


Therefore, SQL query executed by GEL script is the following:

select name project_name
,code project_code
from inv_investments
where id=5000003  --- this is just an internal id sample

In other words, gel_objectInstanceId can be used only when running processes from an object instance.



That’s all. Thanks for reading until here. Did you like it? Please, don’t be shy and share it.