Clarity PPM

Exploit CA PPM XBLs and PMDs

By marku02 posted 04-02-2018 07:54 AM

  

All,

 

Running / Scheduling a Job in CA PPM through Gel Script is possible with very simple code. Here you go.

 

<gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"  >
    <gel:parse var="inputDoc">
        <data>
            <job job_name="Delete Process Instance" job_definition_id="50420"
                job_definition_type="JOB" recurrence_type="4" whenNow="1" whenRecur="1" >
            </job>
        </data>
    </gel:parse>
    <core:catch var="excp">
        <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:new>
        <core:invoke method="executeXBL" on="${xblInstance}" var="responseDoc"/>
    </core:catch>
    <gel:log>Response Doc : <gel:expr select="$responseDoc"/> </gel:log>
    <gel:log>Exception: ${excp} </gel:log>
</gel:script>

 

 

The above code is just for demonstration purpose and it immediately schedules "Delete Process Instance" job to run immediately. There are additional attributes as well as sub elements of "data" element through which we can either schedule any job just the way we do it through UI.

Note: Many hacks into ca ppm are possible with XBLs

7 comments
12 views

Comments

03-27-2019 06:17 AM

Hi Kumar,

 

 

thank You for great the information. Could You also take a look how could we use it in our case as well?

 

Earlier we were able to use XBLs to copy ToDos and Links on the new UI from templates to projects, by calling 'copyProject.xbl', but now we are stuck with a different problem.

 

We are trying to create a baseline update for a specific task, using GEL script, as if the user would open the task list, select a task and hit 'Update Baseline' button. We found 'updateTaskBaseline.xml' and 'baselineTaskProcess.xbl' files which we think could be used but couldn't make it work yet.

 

Any ideas or tips would be higkly appriciated.


Regards,

Ferenc

11-13-2018 07:57 PM

Hi supratikubs,

 

Thank you for information.

I could invoke job with job parameters.

 

Thank you again.

 

Regards,

Shoichi

11-13-2018 06:36 PM

Hi Pawel,

 

Yes you can pass the process instance id to abort processes from XBL.

 

 

Here is the code:

 

<gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope" xmlns:sql="jelly:sql" xmlns:util="jelly:util" xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<core:catch var="excp">
<gel:parse var="inputDoc">
<data>
<process_instance_id value="5644019"/>
</data>
</gel:parse>

 

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

 

 

For a process having sub processed called you might need to pass also the triggered sub process process_instance_id.

 

Thanks,

Supratik

11-13-2018 05:55 PM

Hi Sochi,

 

You can use the following code for running any XBL or Java job including parameters.

 

<gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope" xmlns:sql="jelly:sql" xmlns:util="jelly:util" xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<core:catch var="excp">
<gel:parse var="inputDoc">
<data>
<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"/>
</data>

</gel:parse>

<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:new>
<core:invoke method="executeXBL" on="${xblInstance}" var="responseDoc"/>
<gel:log>Response Doc : <gel:expr select="$responseDoc"/> </gel:log>
</core:catch>
</gel:script>

10-25-2018 11:14 PM

Hi Kumar,

 

Thank you great information.

It is very interesting article for me.

 

 

I would like to know how do I invoke job with job parameters by XBLs?

For example, how do I invoke "Delete Process Instance" job with "Process Name" parameter?

 

 

Regards,

Shoichi

Hi Kumar,

 

do you know why it does not work in my case? I always get <gel:expr> java.lang.NullPointerException.

I am using version 15.5.

 

But let's assume I somehow make it work and then...I am hoping to use the same trick to run the "processInstanceAbort.xbl" to cancel running process instance from the gel script. The only thing is I am not sure how to fill out the rest of the document (inputDoc, args in "com.niku.odf.object.xbl.XBLExecutor" constructor, etc.).

 

You help will be greatly appreciated.

 

Pawel

04-03-2018 07:37 PM

Very cool.  I not spend much time figuring out XBL so this is a great example on how it can be done.

 

V/r,

Gene