Clarity PPM

Expand all | Collapse all

GEL script to change Booking Status on a Project

Jump to Best Answer
  • 1.  GEL script to change Booking Status on a Project

    Posted 03-09-2018 01:28 PM

    I need the ability to change the Booking Status on a project team from Soft to Hard.  From what I've read in the communities, the best way to do this is through a GEL script.  There are a few discussions on this topic that I found and one person even asked how it was solved and didn't get an answer.  Does anyone have a GEL script they would be willing to share or have a start of a script that can get me in the right direction to be able to update the booking status to Hard?  I've been reading up on some documentation and will plan to try to do this on my own but thought I'd ask the community too.

     

    Thanks,

    Garrett



  • 2.  Re: GEL script to change Booking Status on a Project

    Posted 03-12-2018 01:44 AM

    Hi Garrett-S ,

     

    I have created a XOG which updates the booking status from soft to HARD. Booking status = 15 means status is HARD and Booking status = 5 means status is SOFT.

     

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="15.3.0.200"/>
    <Projects>
    <Project name="Project" projectID="0010">
    <Resources>
    <Resource bookingStatus="15" resourceID="shubham.bhatia">
    </Resource>
    </Resources>
    </Project>
    </Projects>
    </NikuDataBus>

     

    You can further create the GEL and use this XOG script to change the booking status.

     

    Let me know if it works for you.

     

    Best Regards

    Shubham



  • 3.  Re: GEL script to change Booking Status on a Project

    Posted 03-12-2018 08:32 AM

    Thanks Shubham.

     

    I may find this out when I start reading the documentation but how I read this XOG is that it will only update shubham.bhatia on project ID 0010.  How do you create the XOG to update all resources on any project that the GEL script runs on?

     

    Garrett



  • 4.  Re: GEL script to change Booking Status on a Project
    Best Answer

    Posted 04-15-2018 01:03 PM

    Garrett,

     

    You'll need to build up the xml.

    To do what you're suggesting "update all resources for a project" via XOG, you'd write a SQL select of the allocated resources (prteam) and do a forEach loop off this select to build up the resource xml.

     

    I.E.

    first get the data of the resources

     <sql:query escapeText="false" var="allocatedresources" xmlns:sql="jelly:sql">

    SELECT ....

    what ever logic you want with user data

    </sql:query>

     

       make XOG request

     

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="15.3.0.200"/>
    <Projects>
    <Project name="Project" projectID="0010">
    <Resources>

     

    use foreach to build up xml

       <core:forEach items="${allocatedresources.rows}" var="thisResource">

          <Resource bookingStatus="15" resourceID="${thisResource.user_name}"></Resource>

        </core:forEach>

     

    </Resources>
    </Project>
    </Projects>
    </NikuDataBus>

     

     

     

    This results in:

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="15.3.0.200"/>
    <Projects>
    <Project name="Project" projectID="0010">

     

    <Resources>
       <Resource bookingStatus="15" resourceID="abc1">

       <Resource bookingStatus="15" resourceID="abc2">

       <Resource bookingStatus="15" resourceID="abc3">

       ..........
    </Resource>

     

    </Resources>
    </Project>
    </Projects>
    </NikuDataBus>