Today James Gille, Clarity PPM Solutions Consultant at Rego Consulting, shows us how to update a field through a gel script. Read his instructions beneath the video player.
Training Video
How to Update a Field through a Gel Script
Clarity PPM |Update Field Status
For this exercise, we have created a custom object off of the project object called "Project Actuals." We access it via Home > Portfolio Management > Projects > Akhila Sample > Properties > Project Actuals List > PA000044.
That object will have field called "Status." It currently reads "New." We're going to update that field to a different status: "Processing." To do so, we'll use a gel script.
Create a Gel Script
To update the status of our object to process, we'll create a gel script in the text editor of our choice. This is Notepad++.
You'll include the name spaces that you need to update a field, which requires including the gel name space for the GEL Tag Library and the SQL name space to update SQL.
xlmns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:sql="jelly:sql"
You'll first want to define your database connection to the Niku schema.
<gel:setDataSource dbID="Niku" var="clarity05"/>
And then you'll create an update statement using the update tag, to update that specific "rego_status" field.
In doing so, we're going to be passing in a parameter from our process, using the gel_objectInstanceId.
And we will now put this into a process, by copying the data in our text editor. To see the entire Gel Script we use in this demo, visit How to Update a Field Through a Gel Script.
Create a New Process
Take your copied text back into Clarity PPM, and create a new process via Administration Menu > Data Administration > Processes > New.
Create a "Process Name" and "Process ID," like "Update Field" and "update_field."
Select "Save."
Tie a Process to an Object
After you've created your new process, tie it to an object via Objects > Add Primary Object > Object Type. Here we select our "Project Actuals" Object.
Save and Return.
Add an Action to a Step
Then we want to add an action to a step, to implement that Gel Script.
So we go to the "Start Step" tab and select New > Custom Script > Next.
Define an "Action Name" for your script. James writes "Execute Script" and his "Action ID" is "execute_script." We'll copy that script code into the "Custom Script" field and select "Save and Return."
Back on the previous page, we need to finish our process by choosing a post condition via Select Step > Finish > Add > Return.
Validation to Activate the Process
Go to the "Validation" tab for the process. Select "Validate All and Activate." This will activate the process, so that we can now go run it.
Project Actuals Record
We'll now go back to our project, "Project Akhila_Sample..." On that project actuals record, we'll select the "Processes" tab and its "Available" sub-tab, check mark our process box, select "Update Field," and click "Start."
Finish the Process
Now we'll go in and finish the process. Note that the "Status" has changed to green, which means our process has finished.
If we go back to the "Properties" tab, we'll see the "Status" has updated to "Processing."
Nice work. That's updating a field through a gel script.
Have an idea for a Clarity PPM Quick Tip? Tell us about it in the comments.
If you want to learn more from Clarity PPM Quick Tips, check out our demo on How to Set Stage Attribute Values.
For free Clarity PPM educational resources, follow us on LinkedIn, browse our nonprofit library, the regoXchange, and join our mailing list below.
Let Rego Be Your Guide
Rego offers free health assessments, webinars, and half-day training classes for Clarity PPM on Roadmaps in the Modern UX, Power BI, Portfolio Management, and Jaspersoft.
For a full list of Clarity Services, visit regoconsulting.com.