Presentation is loading. Please wait.

Presentation is loading. Please wait.

Www.regouniversity.com Clarity Educational Community Updates and Automation Getting Started with GEL Scripts Presented by : Virginia DeCeglia & Chris Shaffer.

Similar presentations


Presentation on theme: "Www.regouniversity.com Clarity Educational Community Updates and Automation Getting Started with GEL Scripts Presented by : Virginia DeCeglia & Chris Shaffer."— Presentation transcript:

1 www.regouniversity.com Clarity Educational Community Updates and Automation Getting Started with GEL Scripts Presented by : Virginia DeCeglia & Chris Shaffer

2 2 Clarity Educational Community Agenda Overview Introducing GEL Scripting Scripting Exercises Q&A

3 3 Clarity Educational Community Prerequisites Basic knowledge creating CA PPM processes Oracle/SQL language CA PPM data model

4 4 Clarity Educational Community Power of Automation Time Spent Task Size Non-Geek Geek Does it manually Gets annoyed Writes script to automate Makes fun of geek’s complicated method Runs script Wins Loses

5 5 Clarity Educational Community What is GEL? GEL stands for Generic Execution Language Based on Jelly, a jakarta.apache.org Commons project Extended and embedded into CA PPM to enable custom logic to solve business problems GEL is the basis for the enterprise application integration framework within CA PPM GEL scripts can be executed from within CA PPM by installing them as processes, or from the command line GEL scripts are executed top down

6 6 Clarity Educational Community What is GEL?, cont. Additional information can be found in the CA Documentation (CAClarityPPM_XOG_DeveloperGuide_ENU.pdf) and at the Apache Jelly website at http://jakarta.apache.org/commons/jelly/index.htmlhttp://jakarta.apache.org/commons/jelly/index.html.

7 7 Clarity Educational Community GEL Data Sources Web Services – GEL can read or write to any SOAP based web service including XOG File System – GEL can read or write to any delimited file accessible on the application server FTP – GEL can upload or download to FTP servers JDBC – GEL uses JDBC to read and write to databases

8 8 Clarity Educational Community GEL Script Structure <gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:core="jelly:core" 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:sql="jelly.sql" xmlns:xog="http://www.niku.com/xog" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> Header Comment Footer

9 9 Clarity Educational Community Header – Tag Namespaces Header contains GEL namespace A GEL script is built from qualified elements bound to java code called tags Tags are organized into tag libraries that dictate what can be used in the script CA PPM ships with many out of the box tag libraries.

10 10 Clarity Educational Community Header – Tag Namespaces, cont. <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="jelly:sql" xmlns:xog="http://www.niku.com/xog" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

11 11 Clarity Educational Community Tags Tags are grouped in pairs, similar to HTML – – Each tag should have a closing tag Tag name comes from the library definition – xmlns:core="jelly:core" Core, SQL, GEL are most common libraries Syntax

12 12 Clarity Educational Community Logging The gel:log tag allows for logging of messages viewable from the CA PPM application You can declare the log to be INFO (Yellow flag) or WARN (Red X) Syntax Log Message

13 13 Clarity Educational Community Comments Commenting your code will save a number of headaches later on. Comment syntax is the same as HTML. Syntax

14 14 Clarity Educational Community Creating Your First Script – Follow Along Create a process Go to Studio / Processes / New

15 15 Clarity Educational Community Creating Your First Script, cont. Add Primary Object Select Project object, Save and Return

16 16 Clarity Educational Community Creating Your First Script, cont. Left click Start Step

17 17 Clarity Educational Community Creating Your First Script, cont. Create a new action

18 18 Clarity Educational Community Creating Your First Script, cont. Select Custom Script Click Next

19 19 Clarity Educational Community Creating Your First Script, cont. Enter action name and id Enter the script into the custom script window <gel:script xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"> My first GEL worked! Validate, then Save and Return

20 20 Clarity Educational Community Creating Your First Script, cont. Under Post-Conditions, click Select Step Select Finish step, click add

21 21 Clarity Educational Community Creating Your First Script, cont. Click Save and Return Select the Validation tab

22 22 Clarity Educational Community Creating Your First Script, cont. Select Validate All and Activate

23 23 Clarity Educational Community Creating Your First Script, cont. 1.Go to project list and select a project 2.Click the Processes tab 3.Select the Available sub-page 4.Select the test script, then click Start

24 24 Clarity Educational Community Creating Your First Script, cont. 5.Screen flips to initiated processes 6.Click the messages flag 7.Your log entry appears 8.The BPM message shows for each step; this is normal

25 25 Clarity Educational Community Questions

26 26 Clarity Educational Community Variables Variables are widely used in GEL scripts Declared at the time of use Most tags can set variables Setting a variable – variable value Reading a variable – ${var_name} Variables are valid for current script only

27 27 Clarity Educational Community Persisting Variables Persisting a variable allows makes it accessible throughout the entire process Persisted variables are only valid for the initiated instance. variable_value

28 28 Clarity Educational Community Built-in Variables Each process has three built in variables – ${gel_objectInstanceId} Object instance ID of the instance the process is executing on Great for project or idea processes – ${gel_processId} ID of the Process itself – ${gel_processInstanceId} Process instance ID

29 29 Clarity Educational Community Process Parameters – Allows passing of values into a GEL script from a CA PPM process Inside the GEL script, you can refer to the parameter as you would any other variable by using ${variablename} The optional attribute secure="true" causes CA PPM to hide the actual value with asterisks (*) in the user interface

30 30 Clarity Educational Community Case Sensitivity Information contained within GEL tags is case sensitive – For example, if you declare a variable as follows: PRJ-123456 – Then reference the variable as follows: ${v_projectid} – PRJ-123456 will not output This will not cause an actual error to occur, so you can’t “catch” this error.

31 31 Clarity Educational Community Add the Database Data Source 1.Add the SQL tag library to the header xmlns:sql="jelly:sql" 2.Add the niku data source at the beginning of the script

32 32 Clarity Educational Community Multiple Data Sources Adding the var tag to the data source allows for multiple data sources

33 33 Clarity Educational Community Query the Database Query structure <![CDATA[ SELECT PRNAME from PRTASK ]]> – The VAR is the array this query will be stored as – dataSource is the variable of the data source to be used If only one data source, this tag is not needed – Always wrap sql statements in the CDATA tag so you can use characters

34 34 Clarity Educational Community Query Parameters Passing parameters <![CDATA[ SELECT PRNAME from PRTASK WHERE PRPROJECTID = ? ]]> – Parameters are in the order of the ? from the query – This creates a bind parameter and is more efficient for the database – Helps with escaped characters and data types.

35 35 Clarity Educational Community Query Results Two ways to get the data out – By Index (Order of columns) Task Name: ${row[0]} – By column name (Preferred Method) Task Name: ${row.prname}

36 36 Clarity Educational Community Update Query <![CDATA[ UPDATEodf_ca_project ocp SETocp.rego_appr_date = sysdate WHEREocp.id = ? ]]> The variable ${updateCnt} contains the number of rows the update statement affects Note: Using CDATA tags in update statements is preferred

37 37 Clarity Educational Community Update Query, cont. Processes often require updating the values of specific attributes – You can to do this is with a SQL Update statement – Keep the following in mind when performing direct database updates Avoid Insert statements – these are best suited for XOG Direct database updates will not trigger a process to start; XOG updates will typically trigger processes to start Avoid updating OOTB tables when possible; using XOG will ensure all CA PPM business rules are followed It is generally safe to update custom attributes with a SQL update (these are typically found in tables beginning with odf_ca) Use extra caution within On-demand environments

38 38 Clarity Educational Community Delete Query <![CDATA[ DELETE FROM Z_CUSTOM_TABLE WHERE id = ? ]]> The update tag is also used for delete statements

39 39 Clarity Educational Community Looping – forEach Use forEach to loop through database result sets.. Do something..

40 40 Clarity Educational Community Looping – While Loop A While Loop can also be create... Do Something.... Don’t forget to update the counter

41 41 Clarity Educational Community Conditional If/Then Core:if is a simple if/then statement XOG URL: ${xogUrl} Conditional Expressions ==Equals !=Not Equals >Greater Than &lt:Less Than ≥Greater Than or Equal To ≤Less Than or Equal To Operational Expressions ||Or && And

42 42 Clarity Educational Community Conditional – Core/Choose/Otherwise core:choose allows you to choose the right path Otherwise is the default action when conditions are not met … …

43 43 Clarity Educational Community Sending Email GEL can send HTML formatted email <gel:email from="Clarity@noreply.com" fromName="Clarity" subject="Subject Line ${invCode}" to="${toEmail}"> <![CDATA[ Hello, this is bolded ]]> Gel:Email uses the mail server set up in the CSA To address can be multiple separated by ; – If the address is listed twice it will fail Uses the xmlns:email="jelly:email" namespace

44 44 Clarity Educational Community Sending Email, cont. Email can be split up with database queries in the middle <gel:email from="Clarity@noreply.com" fromName="Clarity" subject="Subject Line ${invCode}" to="${toEmail}"> <![CDATA[ Hello, this is bolded ]]> <![CDATA[ SELECT … PRT.PRPROJECTID = ? ]]> ${row.full_name}

45 45 Clarity Educational Community Exercise Create an on-demand GEL script on the Project object The GEL script should send a single email that contains a list of resources on the project Create the GEL script, and execute it manually on a project Don’t forget to add the data source and namespaces Use your own email address

46 46 Clarity Educational Community Exercise, cont. Namespaces to use xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:sql="jelly:sql" SQL Script to use <![CDATA[ SELECT FULL_NAME FROM PRTEAM PRT INNER JOIN SRM_RESOURCES SRMR ON PRT.PRRESOURCEID = SRMR.ID WHERE PRT.PRPROJECTID = ? ]]>

47 47 Clarity Educational Community Solution – Shell Create the GEL shell structure with namespaces <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:sql="jelly:sql">

48 48 Clarity Educational Community Solution – Data Source Add the Data Source <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:sql="jelly:sql">

49 49 Clarity Educational Community Solution – SQL Query Add the SQL query after the data source <![CDATA[ SELECT FULL_NAME FROM PRTEAM PRT INNER JOIN SRM_RESOURCES SRMR ON PRT.PRRESOURCEID = SRMR.ID WHERE PRT.PRPROJECTID = ? ORDER BY FULL_NAME ]]>

50 50 Clarity Educational Community Solution – Email Body After the data source <gel:email from="clarity_noreply@clarity.com" fromName="Clarity" subject="Project Team Members" to="Your.Email@here.com"> <![CDATA[ Greetings, the following resources on assigned to the project. ]]>

51 51 Clarity Educational Community Solution – Email Loop After the data source <gel:email from="clarity_noreply@clarity.com" fromName="Clarity" subject="Project Team Members" to="Your.Email@here.com"> <![CDATA[ Greetings, the following resources on assigned to the project. ]]> ${row.FULL_NAME}

52 52 Clarity Educational Community Solution – Completed Script <gel:script xmlns:core="jelly:core" xmlns:email="jelly:email" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:sql="jelly:sql"> SELECT FULL_NAME FROM PRTEAM PRT INNER JOIN SRM_RESOURCES SRMR ON PRT.PRRESOURCEID = SRMR.ID WHERE PRT.PRPROJECTID = ? ORDER BY FULL_NAME <gel:email from="clarity_noreply@clarity.com" fromName="Clarity" subject="Project Team Members" to="chris.shaffer@regoconsulting.com"> <![CDATA[ Greetings, the following resources on assigned to the project. ]]> ${row.FULL_NAME}

53 53 Clarity Educational Community Things to Consider When working with GEL it is important to keep a few things in mind Be careful when hard coding URLs as refreshes from production to non-prod will not automatically update scripts Refreshes can play havoc with email processes – Ensure non-prod systems have email disabled or update email addresses to a dummy address

54 54 Clarity Educational Community Questions Virginia DeCegilia Virginia.DeCegilia@RegoConsulting.com Chris Shaffer Chris.Shaffer@RegoConsulting.com Thank you for your time. Contact US 888.813.0444 Email Contact info@regoconsulting.com Web Site www.regoconsulting.com


Download ppt "Www.regouniversity.com Clarity Educational Community Updates and Automation Getting Started with GEL Scripts Presented by : Virginia DeCeglia & Chris Shaffer."

Similar presentations


Ads by Google