TerriB

GEL script in a Process not running XOG

Discussion created by TerriB on Oct 12, 2010
Latest reply on Oct 12, 2010 by mark
I believe I have a logic problem in a GEL script that I am trying to run as a step in a Process, but I seem unable to figure it out. Ultimately, I am trying to make it easy for a project mgr to mark all the tasks complete on a project using a Process. However, the code I have attached below is a simple sample that I have been using to test with that only changes a project time entry to false, not any of the task data.

So if I remove the SELECT statement below and hard-code the project name and project code then the Process successfully changes time entry to false. BUT with the SELECT statement in the script that uses the objectInstanceId to get the project name and code at run time -- the Process runs -- but time entry does not change to false. I am definately a newbie in GEL & XOG so any expert advice would be greatly appreciated. (Critique as needed...) :grin:
<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:x="jelly:xml"
  xmlns:core="jelly:core"
  xmlns:sql="jelly:sql"
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
  xmlns:file="jelly:com.niku.union.gel.FILETagLibrary"
  xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xog="http://nt2nikudev01/niku/xog">

  <gel:parameter var="XOGusername" default="admin"/>
  <gel:parameter var="XOGpassword" default="admin" secure="true"/>


  <gel:setDataSource dbId="niku"/>


  <!-- query to get project data for thisProject -->




  <sql:query var="resultProject">
    SELECT Name, Code
    FROM INV_INVESTMENTS
    WHERE INV_INVESTMENTS.ID = ${gel_objectInstanceId}
  </sql:query>

  <!-- start loop to get project data -->
  <core:forEach trim="true" items="${resultProject.rowsByIndex}" var="rowP">
    <core:forEach var="fieldP" items="${rowP}">
      <core:set value="${fieldP[0]}" var="sProjName"/>
      <core:set value="${fieldP[1]}" var="sProjID"/>
    </core:forEach>
  </core:forEach>


  <!-- Run XOG inline (not using a file) -->
  <soap:invoke endpoint="http://nt2nikudev01/niku/xog" var="result">
    <soap:message>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xog="http://www.niku.com/xog">
      <soapenv:Body>
        <xog:Login xmlns:xog="http://www.niku.com/xog">
          <xog:Username>${XOGusername}</xog:Username>
          <xog:Password>${XOGpassword}</xog:Password>
        </xog:Login>











        <!-- start of XOG script -->
        <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
          xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
            <Header action="write" externalSource="NIKU" objectType="project" version="12.0.5.5350"/>
             <Projects>
               <Project name="${sProjName}"
                 projectID="${sProjID}"
                 openForTimeEntry="false">
               </Project>
             </Projects>
        </NikuDataBus>
        <!-- end of XOG script -->







        </soapenv:Body>
      </soapenv:Envelope>
    </soap:message>
  </soap:invoke>

</gel:script>

Outcomes