AnsweredAssumed Answered

Run Parameterised Job via GEL & Process

Question asked by Owen_R on Jan 25, 2013
Latest reply on Oct 23, 2017 by EG27
I am trying to create a process which performs a series of housekeeping activities on old projects. What I would like the process to do (for an individual project on-demand, initially) is to set a few field values then run the Purge Financial Tables job then the Purge Documents job for just the initiating project.

I have a main process that does the field stuff and then runs a GEL script with an InvokeAction call to fire up two other individual processes which run each job.

Field stuff works fine. GEL script runs, starts the jobs OK but my issue is in how to pass the parameters those job require. Jobs just finish as the parameter(s) are not passed to them.

By looking at other posts on this I've put my GEL together as follows. I have no idea what tags I should be using under the Request section (or indeed if I should be using the Request element at all), and I'm guessing that the parameter names should be the same as the job parameter names defined in Clarity. Any ideas on how I should be passing things?
<!-- Get the external project code and internal ID from the object instance id - for use as a parameter in jobs-->

<sql:query dataSource="${clarityDS}" escapeText="false" var="project">


<![CDATA[


SELECT 


code, id 


from inv_investments i


where i.id = ${gel_objectInstanceId}


]]> 

</sql:query>


<core:forEach items="${project.rowsByIndex}" trim="true" var="project_data">


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


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

</core:forEach>



<soap:invoke endpoint="${XOGURL}/niku/xog" var="auth">


        <soap:message>



            <soapenv:Envelope     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"









 xmlns:xog="http://www.niku.com/xog">







<soapenv:Header/>




                <soapenv:Body>




                    <xog:Login>






                        <xog:Username>${XOGUsername}</xog:Username>






                        <xog:Password>${XOGPassword}</xog:Password>









</xog:Login>








</soapenv:Body>






</soapenv:Envelope>




</soap:message>

</soap:invoke>



<gel:set asString="true" select="$auth/SOAP-ENV:Envelope/SOAP-ENV:Body/xog:SessionID/text()" var="sessionID"/>

<core:choose>


    <core:when test="${sessionID == null}">



        <gel:log>Couldn't Log in.  Check the username/password.</gel:log>





</core:when>


<core:otherwise></core:otherwise>

</core:choose>




<gel:log>Logging in and running jobs for project ${project_code}...</gel:log>




<soap:invoke endpoint="${XOGURL}/niku/xog" var="runresult">


    <soap:message>



        <soapenv:Envelope     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">




            <soapenv:Header>





                <xog:Auth>






                    <xog:SessionID>${sessionID}</xog:SessionID>









</xog:Auth>





</soapenv:Header>






<soapenv:Body>







<!-- First run Purge Financial Tables job-->







<gel:log>${project_code} Purge financial table job...</gel:log>







<Process xmlns="http://www.niku.com/xog/InvokeAction">








<code>owen_purge_financials</code>








<request>









<thisProject>










param_project_code="${project_id}"









</thisProject>








</request>







</Process>








<!-- Then run Delete Documents job-->







<gel:log>${project_code} Purge documents job...</gel:log>








<Process xmlns="http://www.niku.com/xog/InvokeAction">









<code>archive_purge_docs</code>









<request>










<documents>











retainVersions="-1"











notAccessedDays="-1"











purgeAll="true"











allProjects="false"











projectOBSunitId="-1"











allResources="false"











resourceOBSunitId="-1"











specificResourceId="-1"











allCompanies="false"











companyOBSunitId="-1"











specificCompanyId="-1"











retainVersions="-1











purgeKnowledgeStore="false"











specificProjectId="${project_id}"










</documents>









</request>







</Process>






</soapenv:Body>





</soapenv:Envelope>



</soap:message>


</soap:invoke>
My result in the process messages is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <ProcessResult xmlns="http://www.niku.com/xog/InvokeAction"/>
    </soapenv:Body>
</soapenv:Envelope>
Any suggestions as to what I'm missing?

Thanks

Outcomes