Today James Gille, CA 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
CA 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.
CA PPM |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.
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.
CA PPM |Create a New Process
Take your copied text back into CA 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.”
CA PPM |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.
CA PPM | 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.
CA PPM | 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.
CA PPM | 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.”
CA PPM | 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 CA PPM Quick Tip? Tell us about it in the comments.
If you want to learn more from CA PPM Quick Tips, check out our demo on How to Set Stage Attribute Values.
For free CA PPM educational resources, follow us on LinkedIn, browse our nonprofit library, the regoXchange, and join our mailing list below.