SlideShare ist ein Scribd-Unternehmen logo
1 von 55
www.regoconsulting.com Phone: 1-888-813-0444
The Power of GEL Scripting to Enhance Functionality
Hidden
Automation, CA
PPM (CA Clarity
PPM)
www.regoconsulting.com Phone: 1-888-813-0444
2
● Background of GEL
● Basic Script Structure
● Commonly Used Tags
● Hands on exercises with creating GEL Scripts
● Best Practices
● Real-life Examples
● Q&A
Topics
www.regoconsulting.com Phone: 1-888-813-0444
3
● GEL (Generic Execution Language) is a tool you can use to turn
XML into executable code. It is based on Jelly, a
jakarta.apache.org Commons project. It has been extended
and embedded into CA PPM to enable custom logic to solve
business problems.
● 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.html.
Background of GEL
www.regoconsulting.com Phone: 1-888-813-0444
4
● The GEL run-time is packaged with XOG in the XOG client.
Once the client is installed, you can use the GEL command in
the bin directory of the XOG client to validate and execute GEL
scripts.
● GEL can also be used within CA PPM processes.
GEL Setup
www.regoconsulting.com Phone: 1-888-813-0444
5
<gel:script
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:sql="jelly:sql"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- CODE GOES HERE -->
</gel:script>
Script Structure
Header
Comment
Footer
www.regoconsulting.com Phone: 1-888-813-0444
6
A GEL script is an executable XML file that is built from qualified
elements bound to Java code called tags. Using namespace
declarations, tags are organized into tag libraries which are made
available in a script.
Hello World Example:
<gel:script xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary">
<core:forEach indexVar='i' begin='1' end='3'>
<gel:out>Hello World ${i}!</gel:out>
</core:forEach>
</gel:script>
● Note: An entire script always resides within the GEL script tag.
GEL Tags
www.regoconsulting.com Phone: 1-888-813-0444
7
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:sql="jelly:sql"
xmlns:xog=http://www.niku.com/xog"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:util="jelly:util"
xmlns:email="jelly:email"
xmlns:ftp="jelly:com.niku.union.gel.FTPTagLibrary"
Common Namespaces
www.regoconsulting.com Phone: 1-888-813-0444
8
Variables are used extensively throughout GEL scripts. Many tags can
set variables. An example of a tag that can set variables is core:set. You
can use the common syntax ${variable_name} to reference variables.
In the Hello World example, 'i' is a variable which is set by the forEach
tag and is incremented with each loop.
Hello World Example:
<gel:script xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary">
<core:forEach indexVar='i' begin='1' end='3'>
<gel:out>Hello World ${i}!</gel:out>
</core:forEach>
</gel:script>
Variables
www.regoconsulting.com Phone: 1-888-813-0444
9
● Conditionals / Loops
● Variables / Parameters
● Database Operations
● Logging
● Exception
● SOAP / XOG
● File Operations
● Email
Commonly Used Tags
www.regoconsulting.com Phone: 1-888-813-0444
10
● <core:if>
<core:if test="${hasDocs}">
…
</core:if>
● <core:choose>
<core:choose>
<core:when test="${row[6].equals(&quot;&quot;)}">
…
</core:when>
<core:otherwise>
…
</core:otherwise>
</core:choose>
Conditionals / Loops
www.regoconsulting.com Phone: 1-888-813-0444
11
● <core:forEach>
<core:forEach trim="true" items="${queryResult.rows}" var="row">
…
</core:forEach>
● <gel:forEach>
<gel:forEach select="$projectsXML/NikuDataBus/Projects/Project"
var="currentPrj">
…
</gel:forEach>
● Note that there are two separate forEach loop types. The core version
performs basic FOR looping. If you need to retrieve values from an XML
document to use in the loop condition (that is, need to use a SELECT
clause), then you need the GEL implementation.
Conditionals / Loops cont.
www.regoconsulting.com Phone: 1-888-813-0444
12
● <gel:parameter>
This tag allows values to be passed 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 (that is, using the ${variablename} syntax). The optional attribute
secure="true" causes CA PPM to hide the actual value in the user interface
with asterisks (*).
<gel:parameter var="XOGUsername" default="admin"/>
<gel:parameter var="XOGPassword" default="password" secure="true"/>
Variables
www.regoconsulting.com Phone: 1-888-813-0444
13
● <core:set>
This tag is used to set basic variables; that is, ones that do not need to be extracted from an
XML document. Refer to the variable using the ${variablename} syntax.
<core:set value="1" var="yes"/>
<gel:out>${yes}</gel:out>
You can do some basic math on the variable:
<gel:out>${yes+2}</gel:out>
● <gel:set>
Use this tag when it is necessary to extract the value of the variable from an XML
document. This tag differs from the <core:set> tag in that it takes a select attribute which in
turn requires an XPath statement. If you are unfamiliar with XPath, think of it as a hierarchy
mapping of the XML document. In the example below, the select statement points the way
to the Statistics node of a XOG output file.
<gel:set asString="true" select="$result//XOGOutput/Statistics" var="xogStats"/>
Variables cont.
www.regoconsulting.com Phone: 1-888-813-0444
14
● <gel:persist>
This tag allows you to set variables with a scope that extends beyond the current script.
● <gel:parse>
The <gel:parse> tag is used to create an XML document in memory. This is how you will build XOG
requests. The tag can be used to generate an entire XML document, or specific nodes that can later be
attached into an existing XML document.
<gel:parse var="loadContent">
<NikuDataBus xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_resource.xsd">
<Header version="12.0.0.5028" action="write" objectType="resource“ externalSource=“PS"/>
<Resources>
<Resource resourceId="abc" isActive="true">
<PersonalInformation lastName="doe" firstName="john" emailAddress="jdoe@ca.com"/>
</Resource>
</Resources>
</NikuDataBus>
</gel:parse>
Variables cont.
www.regoconsulting.com Phone: 1-888-813-0444
15
Custom Action GEL scripts associated with processes have the
following parameters available to them:
● Object instance ID
If no object is associated with the process, the ID is -1. Otherwise the
${gel_objectInstanceId} parameter contains the object instance ID.
● Process ID
${gel_processId} is the process identifier; all instances of this process
share this identifier.
● Process instance ID
${gel_processInstanceId} is the process instance identifier; all instances
have a unique value.
● All built-in parameters have a "gel_" prefix and are of data type -
numeric.
Built-in Parameters
www.regoconsulting.com Phone: 1-888-813-0444
16
Information contained within GEL tags is case sensitive. For
example, if you declare a variable as follows:
<core:set var="v_ProjectID">PRJ-123456</core:set>
Then reference the variable as follows:
<gel:out>${v_projectid}</gel:out>
This will not output PRJ-123456. However, this will not cause an
actual error to occur, so you can’t “catch” this error.
Case Sensitive Issues
www.regoconsulting.com Phone: 1-888-813-0444
17
● Datasources
● SQL Queries
● SQL Updates
● SQL Bind Variables / Parameters
● Transactions
Database Operations
www.regoconsulting.com Phone: 1-888-813-0444
18
There are a couple of methods you can use within GEL to connect to
your CA PPM database. The recommended method is to use:
<gel:setDataSource/>
The tag takes the database id attribute as follows:
<gel:setDataSource dbId="Niku" [var="clarityDS"]/>
The above tag takes the connection properties (including password)
from CA PPM’s properties (set in the CSA). Niku, in the above example,
is the ID of the default internal CA PPM database. If you create
additional external database definitions, you can reference them in the
same manner. For example, if you added a second database
connection definition called “ORA-FIN” you could reference it as
follows:
<gel:setDataSource dbId="ORA-FIN"/>
Datasources
www.regoconsulting.com Phone: 1-888-813-0444
19
Note that the var attribute is optional. If you do not specify a variable, the tag
uses the default, and all subsequent SQL calls will use the same default. For
example, you can do:
<gel:setDataSource dbId="Niku"/>
<sql:query var="result">
SELECT 1 from dual
</sql:query>
OR
<gel:setDataSource dbId="Niku" var="clarityDS"/>
<sql:query dataSource="${clarityDS}" var="result">
SELECT 1 from dual
</sql:query>
Datasources cont.
www.regoconsulting.com Phone: 1-888-813-0444
20
<sql:setDataSource>
Reasons to use the <sql:setDataSource> tag
● You are unable to add the database connection to the CSA
● You need to connect to a DB that isn’t Oracle or SQL Server
● You want to run the script from the command line and don’t have a
copy of the properties.xml file on your computer
<sql:setDataSource url="jdbc:oracle:thin:@localhost:1521:NIKU”
driver="oracle.jdbc.driver.OracleDriver” user="${ClarityUser}"
password="${ClarityPassword}" var="clarityDS"/>
Note: The above example allows you to have more than one
datasource defined, and to specify which datasource to use through
the “clarityDS” variable.
Datasources cont.
www.regoconsulting.com Phone: 1-888-813-0444
21
The following is an example of a simple SQL query called from within a GEL script
<sql:query dataSource="${clarityDS}" escapeText="0" var="result">
<![CDATA[
SELECT r.full_name resName,
r.email resEmail
FROM srm_resources r
]]>
</sql:query>
This query returns data in an array (for all intents and purposes) with the name
“result.”
Note: Due to the nature of XML, using certain characters (‘<‘, ‘>’) within your
query would cause an error without enclosing the query in the CDATA tag.
Because of this, it is a best practice to include this tag in all queries.
SQL Query
www.regoconsulting.com Phone: 1-888-813-0444
22
You can then access the data in the “result” array using the <core:forEach>
tag. There are a couple of different ways to do this:
<!-- By Index -->
<core:forEach trim="true" items="${result.rowsByIndex}" var="row">
<gel:out>Resource Name: ${row[0]}</gel:out>
</core:forEach>
<!-- By Column Name (Preferred Method) -->
<core:forEach trim="true" items="${result.rows}" var="row">
<gel:out>Resource Name: ${row.resName}</gel:out>
</core:forEach>
Note: When possible, avoid setting a bunch of variables with the results of
the query.
SQL Query cont.
www.regoconsulting.com Phone: 1-888-813-0444
23
Often times processes require updating the values of specific
attributes. One of the ways to do this is with a SQL Update statement.
Keep in mind the following when performing direct database updates
● Generally speaking, it is best to avoid Insert statements – these are
best suited for XOG
● Direct database updates will not trigger a process to start – XOG
updates typically will 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
● Extra caution should also be used within On-demand environments
SQL Update
www.regoconsulting.com Phone: 1-888-813-0444
24
Example
<sql:update dataSource="${clarityDS}" escapeText="0"
var="updateCnt">
<![CDATA[
UPDATE odf_ca_project ocp
SET ocp.rego_appr_date = sysdate
WHERE ocp.id = ${gel_objectInstanceId}
]]>
</sql:update>
The variable ${updateCnt} will contain the number of rows that the
update statement affects
Note: Using CDATA tags in update statements is also preferred.
SQL Update cont.
www.regoconsulting.com Phone: 1-888-813-0444
25
Many times SQL statements will include variables that are passed in to the statement. It is best to set
these up as parameters within the SQL Statement. This serves a couple of purposes:
● Ensures data types are correct
● Prevents SQL injection
● Allows reuse of SQL statements for performance gains
Example:
<sql:update dataSource="${clarityDS}" escapeText="0" var="updateCnt">
<![CDATA[
UPDATE odf_ca_project ocp
SET ocp.rego_appr_date = sysdate,
ocp.rego_resource = ?
WHERE ocp.id = ?
]]>
<sql:param value="${row.resourceId}"/>
<sql:param value="${gel_objectInstanceId}"/>
</sql:update>
Note: You must have a <sql:param> tag for each ? in the SQL statement, even if they are using the same
value. The parameters also must be placed in the order that they appear in the statement.
SQL Bind Variables / Parameters
www.regoconsulting.com Phone: 1-888-813-0444
26
● Very Useful if you need your updates to be “All or Nothing”
<sql:transaction dataSource="${clarityDS}">
<core:set value="0" var="errorCnt"/>
<core:catch var="sqlException">
<sql:update escapeText="0" var="updateCnt">
<!-- SQL UPDATE -->
</sql:update>
</core:catch>
<core:if test="${!empty sqlException}">
<core:set value="1" var="errorCnt"/>
</core:if>
<!-- COMMIT OR ROLLBACK SQL TRANSACTION -->
<core:choose>
<core:when test="${errorCnt == 0}">
<!-- COMMIT TRANSACTIONS -->
<sql:update>COMMIT</sql:update>
</core:when>
<core:otherwise>
<!-- ROLLBACK TRANSACTIONS -->
<sql:update>ROLLBACK</sql:update>
</core:otherwise>
</core:choose>
</sql:transaction>
SQL Transaction
www.regoconsulting.com Phone: 1-888-813-0444
27
● Use this tag to insert status messages into the process engine
log table
● Very useful when debugging scripts
● Avoid using too many logging statements, as it can impact
performance
● Different levels of logging – INFO, WARN, ERROR
<gel:log level="INFO">This is an example log message.</gel:log>
Logging Messages
www.regoconsulting.com Phone: 1-888-813-0444
28
Use the GEL fault-handling tags to catch exceptions and exit gracefully when a process
failure occurs. Use the <core:catch> tag to capture exceptions into a variable. Outside of
the catch tags, you can check the variable and write it to the console.
Example:
<core:catch var="sqlException">
<sql:query dataSource="${clarityDS}" escapeText="0" var="result">
<![CDATA[
SELECT r.id,
FROM srm_resources r
]]>
</sql:query>
</core:catch>
<core:if test="${!empty sqlException}">
<gel:log level="ERROR">Exception: ${sqlException}</gel:log>
</core:if>
Exceptions
www.regoconsulting.com Phone: 1-888-813-0444
29
CA PPM Environment:
http://54.193.48.58:8081/niku/nu#action:homeActionId
Username: regou
Password: Clarity123
Note: When creating processes, please distinguish your process
from others by using your name in the process name and id
Example:
Hands On Exercises
www.regoconsulting.com Phone: 1-888-813-0444
30
● URLs are not set up correctly in the properties.xml file. This
means that if you need to reference the URL, you’ll have to
hard-code it.
Example:
<gel:parameter var=“URL" default="http://54.193.48.58:8081"/>
● Caching Issues
Limitations to Rego U Environment
www.regoconsulting.com Phone: 1-888-813-0444
31
Create a process that uses a GEL script to update the following fields
on the project object:
Approved By (rego_appr_by): Resource that started the process
Approval Date (rego_appr_date): Today’s Date
Note: Environment is an Oracle environment
Approved By field uses the Resource Browse lookup (srm_resources.id)
Exercise #1
www.regoconsulting.com Phone: 1-888-813-0444
32
SQL to update project fields:
UPDATE odf_ca_project ocp
SET ocp.rego_appr_date = sysdate,
ocp.rego_appr_by = (SELECT r.id
FROM bpm_run_processes brp
JOIN srm_resources r ON brp.initiated_by = r.user_id
WHERE brp.id = ?)
WHERE ocp.id = ?
Exercise #1 Hint
www.regoconsulting.com Phone: 1-888-813-0444
33
Exercise #1 Review
www.regoconsulting.com Phone: 1-888-813-0444
34
By including the SOAP and XOG namespaces in GEL scripts, you give
GEL the ability to communicate with the XOG web service. You must
package each invocation in a proper SOAP envelope.
The following steps must be used within a GEL script to communicate
with the XOG web service:
● Include the proper namespaces
● Obtain a session ID
● Create the XML file to send
● Execute the XOG
● Parse the Results
● Logout
SOAP / XOG
www.regoconsulting.com Phone: 1-888-813-0444
35
<gel:script xmlns:core="jelly:core“
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary“
xmlns:xog="http://www.niku.com/xog"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel
ope/">
XOG - Include the proper namespaces
www.regoconsulting.com Phone: 1-888-813-0444
36
<!-- Get sessionId by username -->
<gel:parameter var="username" default="admin"/>
<core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId" />
<core:invokeStatic var="userSessionCtrl"
className="com.niku.union.security.UserSessionControllerFactory" method="getInstance"
/>
<core:set var="secId" value="${userSessionCtrl.init(username, secId)}"/>
<core:set var="XOGUsername" value="${secId.getUserName()}"/>
<core:set var="sessionID" value="${secId.getSessionId()}"/>
<core:choose>
<core:when test="${sessionID == null}">
<gel:log level="ERROR"> Unable to obtain a Session ID. </gel:log>
</core:when>
<core:otherwise>
<!-- Execute XOG -->
</core:otherwise>
</core:choose>
XOG - Obtain a Session ID
www.regoconsulting.com Phone: 1-888-813-0444
37
Example:
<gel:parse var="userXML">
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd">
<Header action="write" externalSource="NIKU" objectType="user" version="13.2.0.472"/>
<Users>
<User externalId=" " isLDAP="false" uiThemeDefaultPartitionCode=" "
userLanguage="English" userLocale="en_US” userName="${row.userName}"
userStatus="${row.userStatus}" userTimezone="America/Los_Angeles"
userType="INTERNAL">
<PersonalInformation emailAddress="${row.email}" firstName="${row.firstName}"
lastName="${row.lastName}"/>
<Resource resourceId="${row.resourceId}"/>
<Groups/>
</User>
</Users>
</NikuDataBus>
</gel:parse>
XOG - Create the XML File
www.regoconsulting.com Phone: 1-888-813-0444
38
<!-- Execute XOG -->
<soap:invoke endpoint=“internal" var="result">
<soap:message>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<gel:include select="$userXML"/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
XOG - Execute the XOG
www.regoconsulting.com Phone: 1-888-813-0444
39
<!-- Parse Results -->
<gel:set asString="true" select="$result//XOGOutput/Status/@state" var="XOGState"/>
<core:choose>
<!-- Success -->
<core:when test="${XOGState == 'SUCCESS'}">
<gel:set asString="true" select="$result//XOGOutput/Statistics" var="xogStats"/>
<gel:log level="INFO">User XOG Stats: ${xogStats} </gel:log>
</core:when>
<!-- Failure -->
<core:otherwise>
<gel:log level="WARN"><gel:expr select="$userXML/"/></gel:log>
<gel:log level="ERROR"><gel:expr select="$result/"/></gel:log>
</core:otherwise>
</core:choose>
XOG - Parse the Results
www.regoconsulting.com Phone: 1-888-813-0444
40
<!-- Logout XOG-->
<soap:invoke endpoint=“internal" var="result">
<soap:message>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<xog:Logout/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
XOG - Logout
www.regoconsulting.com Phone: 1-888-813-0444
41
Create a process that can be initiated from a custom object for a
Project Request that will XOG in a new project
Exercise #2
• Create project using the
Name and ID of the Project
Request
www.regoconsulting.com Phone: 1-888-813-0444
42
Sample Project XOG:
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
<Header version="6.0.11" action="write" objectType="project"
externalSource="NIKU"/>
<Projects>
<Project name="Test Project" projectID="PR1234" />
</Projects>
</NikuDataBus>
SQL to get Project Request Name and ID:
SELECT pr.code prjCode,
pr.name prjName
FROM odf_ca_rego_prj_req pr
WHERE pr.id = ?
Exercise #2 Hint
www.regoconsulting.com Phone: 1-888-813-0444
43
Exercise #2 Review
www.regoconsulting.com Phone: 1-888-813-0444
44
GEL can open a file (and if it is an XML file or a comma-delimited
file, parse out all the nodes and attributes), read the file, and
write to it. It can also perform FTP operations on files. It cannot,
however, create a directory to put files in, move files around, or
delete files after it is done with them.
File Operations
www.regoconsulting.com Phone: 1-888-813-0444
45
<gel:script xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:files="jelly:com.niku.union.gel.FileTagLibrary">
<gel:parameter var="vFileName" default="/fs0/clarity1/share/RESOURCES.CSV"/>
<files:readFile fileName="${vFileName}" delimiter="|" var="vResourceData"
embedded="false"/>
<core:forEach items="${vResourceData.rows}" var="row" begin="1" end="10">
<gel:log level="INFO"> Resource Last Name: ${row[0]} </gel:log>
<gel:log level="INFO"> Resource First Name: ${row[1]} </gel:log>
</core:forEach>
</gel:script>
File Operations – Read File
www.regoconsulting.com Phone: 1-888-813-0444
46
<file:writeFile delimiter="," embedded="false" fileName=" Resources.csv ">
<sql:query dataSource="${clarityDS}" escapeText="0" var="result">
<![CDATA[
SELECT u.first_name firstName,
u.last_name lastName,
u.user_name userName
FROM cmn_sec_users u
WHERE u.user_status_id = 200
]]>
</sql:query>
<core:forEach items="${result.rows}" trim="true" var="row">
<file:line>
<file:column value="${row.userName}"/>
<file:column value="${row.lastName}"/>
<file:column value="${row.firstName}"/>
</file:line>
</core:forEach>
</file:writeFile>
File Operations – Write File
www.regoconsulting.com Phone: 1-888-813-0444
47
GEL scripts are often used to send emails. Using a GEL script
notification allows for a lot more flexibility than sending an
action item. There are two types of email tags, <gel:email> and
<email:email>. It is recommended to use the <gel:email> tag
where possible.
Email
www.regoconsulting.com Phone: 1-888-813-0444
48
<gel:email>
● Email server information is derived from the properties.xml of the installation.
● Supports HTML
Example:
<gel:script xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary">
<gel:email from="clarity-do-not-reply@ca.com" subject="Clarity - Test Email" to="john@gmail.com">
<![CDATA[
This is a test email.
<br/>
<br/>
-------------------------------------------------------------------
<br/>
This is an automated message, please do not reply.
]]>
</gel:email>
</gel:script>
Email cont.
www.regoconsulting.com Phone: 1-888-813-0444
49
<email:email>
● Mail Server must be specified within the tag
● Does not support HTML
● Supports Attachments
Example:
<gel:script xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:email="jelly:email">
<core:invokeStatic className="java.lang.System" method="getenv" var="NIKU_HOME">
<core:arg value="NIKU_HOME"/>
</core:invokeStatic>
<gel:parse file="${NIKU_HOME}/config/properties.xml" var="properties"/>
<gel:set asString="true" select="$properties/properties/mailServer/@host" var="mailServer"/>
<email:email to="john@gmail.com" from="clarity-do-not-reply@ca.com" subject=“app-ca.log file"
server="${mailServer}" attach="${NIKU_HOME}/logs/app-ca.log">
App-ca.log File
</email:email>
</gel:script>
Email cont.
www.regoconsulting.com Phone: 1-888-813-0444
50
Write a script that will email a list of all active projects with
managers that are not active users in CA PPM to the resources
within the following group:
Exercise #3
www.regoconsulting.com Phone: 1-888-813-0444
51
SQL to get Resources in Group:
SELECT r.first_name || ' ' || r.last_name resName,
r.email resEmail
FROM cmn_sec_user_groups ug
JOIN cmn_sec_groups g ON ug.group_id = g.id AND g.group_code = 'regou_gel_script'
JOIN srm_resources r ON r.user_id = ug.user_id
SQL to get Projects:
SELECT i.id prjId,
i.code prjCode,
i.name prjName,
r.full_name prjMgr
FROM inv_investments i
JOIN inv_projects ip ON ip.prid = i.id AND ip.is_template = 0 AND ip.is_program = 0 AND (i.purge_flag =
0 OR i.purge_flag IS NULL)
JOIN odf_ca_project ocp ON i.id = ocp.id
JOIN cmn_sec_users u ON i.manager_id = u.id AND u.user_status_id != 200
JOIN srm_resources r ON u.id = r.user_id
Send Emails from the following email address: technical@regoconsulting.com
Exercise #3 Hint
www.regoconsulting.com Phone: 1-888-813-0444
52
Exercise #3 Review
www.regoconsulting.com Phone: 1-888-813-0444
53
● If a variable can be changed by an admin, or stores a password, use the
<gel:parameter> tag instead of <core:set>
● Comment your code
● Properly format and indent your code
● Place all code within the <gel:script> tags, even comments
● Avoid excessive logging, but keep enough for debugging purposes
● When possible, pull server info from properties file on server
Example:
<core:invokeStatic className="java.lang.System" method="getenv" var="NIKU_HOME">
<core:arg value="NIKU_HOME"/>
</core:invokeStatic>
<gel:parse file="${NIKU_HOME}/config/properties.xml" var="properties"/>
<gel:set asString="true"
select="$properties/properties/webServer/webServerInstance[@id='app']/@sslEntryUrl" var="URL"/>
Best Practices
www.regoconsulting.com Phone: 1-888-813-0444
54
● Integrations with HR
● Integrations with Financial systems
● Timesheet Notifications
● Updating Resource Rights
● What have you used GEL scripts for?
Real Life Examples
www.regoconsulting.com Phone: 1-888-813-0444
55
Thank you.
Questions
Contact US
888.813.0444
Email Contact
info@regoconsulting.com
Web Site
www.regoconsulting.com

Weitere ähnliche Inhalte

Was ist angesagt?

Oracle Forms Triggers
Oracle Forms TriggersOracle Forms Triggers
Oracle Forms TriggersSekhar Byna
 
User hook implemantation sample example
User hook implemantation  sample exampleUser hook implemantation  sample example
User hook implemantation sample exampleAshish Harbhajanka
 
Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...Ahmed Elshayeb
 
Bootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and ReactBootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and ReactVMware Tanzu
 
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...Gurpreet singh
 
Designing Structured Streaming Pipelines—How to Architect Things Right
Designing Structured Streaming Pipelines—How to Architect Things RightDesigning Structured Streaming Pipelines—How to Architect Things Right
Designing Structured Streaming Pipelines—How to Architect Things RightDatabricks
 
PostgreSQL and CockroachDB SQL
PostgreSQL and CockroachDB SQLPostgreSQL and CockroachDB SQL
PostgreSQL and CockroachDB SQLCockroachDB
 
Data profiling in Apache Calcite
Data profiling in Apache CalciteData profiling in Apache Calcite
Data profiling in Apache CalciteDataWorks Summit
 
Javascript this keyword
Javascript this keywordJavascript this keyword
Javascript this keywordPham Huy Tung
 
Intro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersIntro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersDaniel McGhan
 
Oracle Inventory Restrict user from update item attribute personalization
Oracle Inventory Restrict user from update item attribute personalizationOracle Inventory Restrict user from update item attribute personalization
Oracle Inventory Restrict user from update item attribute personalizationAhmed Elshayeb
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Flink Forward
 
Oracle Personalization How To Restricting users from assigning items to diffe...
Oracle Personalization How To Restricting users from assigning items to diffe...Oracle Personalization How To Restricting users from assigning items to diffe...
Oracle Personalization How To Restricting users from assigning items to diffe...Ahmed Elshayeb
 
Oracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.pptOracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.pptahosainy
 
Developing New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlDeveloping New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlOdoo
 
Oracle Forms Creation
Oracle Forms CreationOracle Forms Creation
Oracle Forms CreationSekhar Byna
 

Was ist angesagt? (20)

Django Celery
Django Celery Django Celery
Django Celery
 
Oracle Forms Triggers
Oracle Forms TriggersOracle Forms Triggers
Oracle Forms Triggers
 
User hook implemantation sample example
User hook implemantation  sample exampleUser hook implemantation  sample example
User hook implemantation sample example
 
Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...Personalization to restrict values in customer name and number lov in sales o...
Personalization to restrict values in customer name and number lov in sales o...
 
Bootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and ReactBootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and React
 
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
Designing Structured Streaming Pipelines—How to Architect Things Right
Designing Structured Streaming Pipelines—How to Architect Things RightDesigning Structured Streaming Pipelines—How to Architect Things Right
Designing Structured Streaming Pipelines—How to Architect Things Right
 
Report Manager in Oracle EBS R12
Report Manager in Oracle EBS R12Report Manager in Oracle EBS R12
Report Manager in Oracle EBS R12
 
PostgreSQL and CockroachDB SQL
PostgreSQL and CockroachDB SQLPostgreSQL and CockroachDB SQL
PostgreSQL and CockroachDB SQL
 
Data profiling in Apache Calcite
Data profiling in Apache CalciteData profiling in Apache Calcite
Data profiling in Apache Calcite
 
Javascript this keyword
Javascript this keywordJavascript this keyword
Javascript this keyword
 
Intro to JavaScript for APEX Developers
Intro to JavaScript for APEX DevelopersIntro to JavaScript for APEX Developers
Intro to JavaScript for APEX Developers
 
Oracle Inventory Restrict user from update item attribute personalization
Oracle Inventory Restrict user from update item attribute personalizationOracle Inventory Restrict user from update item attribute personalization
Oracle Inventory Restrict user from update item attribute personalization
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
 
ETL in Clojure
ETL in ClojureETL in Clojure
ETL in Clojure
 
Oracle Personalization How To Restricting users from assigning items to diffe...
Oracle Personalization How To Restricting users from assigning items to diffe...Oracle Personalization How To Restricting users from assigning items to diffe...
Oracle Personalization How To Restricting users from assigning items to diffe...
 
Oracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.pptOracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.ppt
 
Developing New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlDeveloping New Widgets for your Views in Owl
Developing New Widgets for your Views in Owl
 
Oracle Forms Creation
Oracle Forms CreationOracle Forms Creation
Oracle Forms Creation
 

Ähnlich wie Rego University: Hidden Automation & Gel Scripting, CA PPM (CA Clarity PPM)

Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaPrajal Kulkarni
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with SolrErik Hatcher
 
Drupal for ng_os
Drupal for ng_osDrupal for ng_os
Drupal for ng_osdstuartnz
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentationdidip
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeMarco Gralike
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRCtepsum
 
Searching for AI - Leveraging Solr for classic Artificial Intelligence tasks
Searching for AI - Leveraging Solr for classic Artificial Intelligence tasksSearching for AI - Leveraging Solr for classic Artificial Intelligence tasks
Searching for AI - Leveraging Solr for classic Artificial Intelligence tasksAlexandre Rafalovitch
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в MagentoMagecom Ukraine
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Max Andersen
 
前瞻性Web性能优化pwpo
前瞻性Web性能优化pwpo前瞻性Web性能优化pwpo
前瞻性Web性能优化pwpoMichael Zhang
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performanceEngine Yard
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django applicationbangaloredjangousergroup
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
The A to Z of developing for the web
The A to Z of developing for the webThe A to Z of developing for the web
The A to Z of developing for the webMatt Wood
 

Ähnlich wie Rego University: Hidden Automation & Gel Scripting, CA PPM (CA Clarity PPM) (20)

treeview
treeviewtreeview
treeview
 
treeview
treeviewtreeview
treeview
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Drupal for ng_os
Drupal for ng_osDrupal for ng_os
Drupal for ng_os
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentation
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
 
Gg steps
Gg stepsGg steps
Gg steps
 
Searching for AI - Leveraging Solr for classic Artificial Intelligence tasks
Searching for AI - Leveraging Solr for classic Artificial Intelligence tasksSearching for AI - Leveraging Solr for classic Artificial Intelligence tasks
Searching for AI - Leveraging Solr for classic Artificial Intelligence tasks
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
前瞻性Web性能优化pwpo
前瞻性Web性能优化pwpo前瞻性Web性能优化pwpo
前瞻性Web性能优化pwpo
 
Oracle GoldenGate
Oracle GoldenGateOracle GoldenGate
Oracle GoldenGate
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django application
 
JSTL.pptx
JSTL.pptxJSTL.pptx
JSTL.pptx
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
The A to Z of developing for the web
The A to Z of developing for the webThe A to Z of developing for the web
The A to Z of developing for the web
 

Kürzlich hochgeladen

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Kürzlich hochgeladen (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

Rego University: Hidden Automation & Gel Scripting, CA PPM (CA Clarity PPM)

  • 1. www.regoconsulting.com Phone: 1-888-813-0444 The Power of GEL Scripting to Enhance Functionality Hidden Automation, CA PPM (CA Clarity PPM)
  • 2. www.regoconsulting.com Phone: 1-888-813-0444 2 ● Background of GEL ● Basic Script Structure ● Commonly Used Tags ● Hands on exercises with creating GEL Scripts ● Best Practices ● Real-life Examples ● Q&A Topics
  • 3. www.regoconsulting.com Phone: 1-888-813-0444 3 ● GEL (Generic Execution Language) is a tool you can use to turn XML into executable code. It is based on Jelly, a jakarta.apache.org Commons project. It has been extended and embedded into CA PPM to enable custom logic to solve business problems. ● 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.html. Background of GEL
  • 4. www.regoconsulting.com Phone: 1-888-813-0444 4 ● The GEL run-time is packaged with XOG in the XOG client. Once the client is installed, you can use the GEL command in the bin directory of the XOG client to validate and execute GEL scripts. ● GEL can also be used within CA PPM processes. GEL Setup
  • 6. www.regoconsulting.com Phone: 1-888-813-0444 6 A GEL script is an executable XML file that is built from qualified elements bound to Java code called tags. Using namespace declarations, tags are organized into tag libraries which are made available in a script. Hello World Example: <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"> <core:forEach indexVar='i' begin='1' end='3'> <gel:out>Hello World ${i}!</gel:out> </core:forEach> </gel:script> ● Note: An entire script always resides within the GEL script tag. GEL Tags
  • 8. www.regoconsulting.com Phone: 1-888-813-0444 8 Variables are used extensively throughout GEL scripts. Many tags can set variables. An example of a tag that can set variables is core:set. You can use the common syntax ${variable_name} to reference variables. In the Hello World example, 'i' is a variable which is set by the forEach tag and is incremented with each loop. Hello World Example: <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"> <core:forEach indexVar='i' begin='1' end='3'> <gel:out>Hello World ${i}!</gel:out> </core:forEach> </gel:script> Variables
  • 9. www.regoconsulting.com Phone: 1-888-813-0444 9 ● Conditionals / Loops ● Variables / Parameters ● Database Operations ● Logging ● Exception ● SOAP / XOG ● File Operations ● Email Commonly Used Tags
  • 10. www.regoconsulting.com Phone: 1-888-813-0444 10 ● <core:if> <core:if test="${hasDocs}"> … </core:if> ● <core:choose> <core:choose> <core:when test="${row[6].equals(&quot;&quot;)}"> … </core:when> <core:otherwise> … </core:otherwise> </core:choose> Conditionals / Loops
  • 11. www.regoconsulting.com Phone: 1-888-813-0444 11 ● <core:forEach> <core:forEach trim="true" items="${queryResult.rows}" var="row"> … </core:forEach> ● <gel:forEach> <gel:forEach select="$projectsXML/NikuDataBus/Projects/Project" var="currentPrj"> … </gel:forEach> ● Note that there are two separate forEach loop types. The core version performs basic FOR looping. If you need to retrieve values from an XML document to use in the loop condition (that is, need to use a SELECT clause), then you need the GEL implementation. Conditionals / Loops cont.
  • 12. www.regoconsulting.com Phone: 1-888-813-0444 12 ● <gel:parameter> This tag allows values to be passed 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 (that is, using the ${variablename} syntax). The optional attribute secure="true" causes CA PPM to hide the actual value in the user interface with asterisks (*). <gel:parameter var="XOGUsername" default="admin"/> <gel:parameter var="XOGPassword" default="password" secure="true"/> Variables
  • 13. www.regoconsulting.com Phone: 1-888-813-0444 13 ● <core:set> This tag is used to set basic variables; that is, ones that do not need to be extracted from an XML document. Refer to the variable using the ${variablename} syntax. <core:set value="1" var="yes"/> <gel:out>${yes}</gel:out> You can do some basic math on the variable: <gel:out>${yes+2}</gel:out> ● <gel:set> Use this tag when it is necessary to extract the value of the variable from an XML document. This tag differs from the <core:set> tag in that it takes a select attribute which in turn requires an XPath statement. If you are unfamiliar with XPath, think of it as a hierarchy mapping of the XML document. In the example below, the select statement points the way to the Statistics node of a XOG output file. <gel:set asString="true" select="$result//XOGOutput/Statistics" var="xogStats"/> Variables cont.
  • 14. www.regoconsulting.com Phone: 1-888-813-0444 14 ● <gel:persist> This tag allows you to set variables with a scope that extends beyond the current script. ● <gel:parse> The <gel:parse> tag is used to create an XML document in memory. This is how you will build XOG requests. The tag can be used to generate an entire XML document, or specific nodes that can later be attached into an existing XML document. <gel:parse var="loadContent"> <NikuDataBus xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation="../xsd/nikuxog_resource.xsd"> <Header version="12.0.0.5028" action="write" objectType="resource“ externalSource=“PS"/> <Resources> <Resource resourceId="abc" isActive="true"> <PersonalInformation lastName="doe" firstName="john" emailAddress="jdoe@ca.com"/> </Resource> </Resources> </NikuDataBus> </gel:parse> Variables cont.
  • 15. www.regoconsulting.com Phone: 1-888-813-0444 15 Custom Action GEL scripts associated with processes have the following parameters available to them: ● Object instance ID If no object is associated with the process, the ID is -1. Otherwise the ${gel_objectInstanceId} parameter contains the object instance ID. ● Process ID ${gel_processId} is the process identifier; all instances of this process share this identifier. ● Process instance ID ${gel_processInstanceId} is the process instance identifier; all instances have a unique value. ● All built-in parameters have a "gel_" prefix and are of data type - numeric. Built-in Parameters
  • 16. www.regoconsulting.com Phone: 1-888-813-0444 16 Information contained within GEL tags is case sensitive. For example, if you declare a variable as follows: <core:set var="v_ProjectID">PRJ-123456</core:set> Then reference the variable as follows: <gel:out>${v_projectid}</gel:out> This will not output PRJ-123456. However, this will not cause an actual error to occur, so you can’t “catch” this error. Case Sensitive Issues
  • 17. www.regoconsulting.com Phone: 1-888-813-0444 17 ● Datasources ● SQL Queries ● SQL Updates ● SQL Bind Variables / Parameters ● Transactions Database Operations
  • 18. www.regoconsulting.com Phone: 1-888-813-0444 18 There are a couple of methods you can use within GEL to connect to your CA PPM database. The recommended method is to use: <gel:setDataSource/> The tag takes the database id attribute as follows: <gel:setDataSource dbId="Niku" [var="clarityDS"]/> The above tag takes the connection properties (including password) from CA PPM’s properties (set in the CSA). Niku, in the above example, is the ID of the default internal CA PPM database. If you create additional external database definitions, you can reference them in the same manner. For example, if you added a second database connection definition called “ORA-FIN” you could reference it as follows: <gel:setDataSource dbId="ORA-FIN"/> Datasources
  • 19. www.regoconsulting.com Phone: 1-888-813-0444 19 Note that the var attribute is optional. If you do not specify a variable, the tag uses the default, and all subsequent SQL calls will use the same default. For example, you can do: <gel:setDataSource dbId="Niku"/> <sql:query var="result"> SELECT 1 from dual </sql:query> OR <gel:setDataSource dbId="Niku" var="clarityDS"/> <sql:query dataSource="${clarityDS}" var="result"> SELECT 1 from dual </sql:query> Datasources cont.
  • 20. www.regoconsulting.com Phone: 1-888-813-0444 20 <sql:setDataSource> Reasons to use the <sql:setDataSource> tag ● You are unable to add the database connection to the CSA ● You need to connect to a DB that isn’t Oracle or SQL Server ● You want to run the script from the command line and don’t have a copy of the properties.xml file on your computer <sql:setDataSource url="jdbc:oracle:thin:@localhost:1521:NIKU” driver="oracle.jdbc.driver.OracleDriver” user="${ClarityUser}" password="${ClarityPassword}" var="clarityDS"/> Note: The above example allows you to have more than one datasource defined, and to specify which datasource to use through the “clarityDS” variable. Datasources cont.
  • 21. www.regoconsulting.com Phone: 1-888-813-0444 21 The following is an example of a simple SQL query called from within a GEL script <sql:query dataSource="${clarityDS}" escapeText="0" var="result"> <![CDATA[ SELECT r.full_name resName, r.email resEmail FROM srm_resources r ]]> </sql:query> This query returns data in an array (for all intents and purposes) with the name “result.” Note: Due to the nature of XML, using certain characters (‘<‘, ‘>’) within your query would cause an error without enclosing the query in the CDATA tag. Because of this, it is a best practice to include this tag in all queries. SQL Query
  • 22. www.regoconsulting.com Phone: 1-888-813-0444 22 You can then access the data in the “result” array using the <core:forEach> tag. There are a couple of different ways to do this: <!-- By Index --> <core:forEach trim="true" items="${result.rowsByIndex}" var="row"> <gel:out>Resource Name: ${row[0]}</gel:out> </core:forEach> <!-- By Column Name (Preferred Method) --> <core:forEach trim="true" items="${result.rows}" var="row"> <gel:out>Resource Name: ${row.resName}</gel:out> </core:forEach> Note: When possible, avoid setting a bunch of variables with the results of the query. SQL Query cont.
  • 23. www.regoconsulting.com Phone: 1-888-813-0444 23 Often times processes require updating the values of specific attributes. One of the ways to do this is with a SQL Update statement. Keep in mind the following when performing direct database updates ● Generally speaking, it is best to avoid Insert statements – these are best suited for XOG ● Direct database updates will not trigger a process to start – XOG updates typically will 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 ● Extra caution should also be used within On-demand environments SQL Update
  • 24. www.regoconsulting.com Phone: 1-888-813-0444 24 Example <sql:update dataSource="${clarityDS}" escapeText="0" var="updateCnt"> <![CDATA[ UPDATE odf_ca_project ocp SET ocp.rego_appr_date = sysdate WHERE ocp.id = ${gel_objectInstanceId} ]]> </sql:update> The variable ${updateCnt} will contain the number of rows that the update statement affects Note: Using CDATA tags in update statements is also preferred. SQL Update cont.
  • 25. www.regoconsulting.com Phone: 1-888-813-0444 25 Many times SQL statements will include variables that are passed in to the statement. It is best to set these up as parameters within the SQL Statement. This serves a couple of purposes: ● Ensures data types are correct ● Prevents SQL injection ● Allows reuse of SQL statements for performance gains Example: <sql:update dataSource="${clarityDS}" escapeText="0" var="updateCnt"> <![CDATA[ UPDATE odf_ca_project ocp SET ocp.rego_appr_date = sysdate, ocp.rego_resource = ? WHERE ocp.id = ? ]]> <sql:param value="${row.resourceId}"/> <sql:param value="${gel_objectInstanceId}"/> </sql:update> Note: You must have a <sql:param> tag for each ? in the SQL statement, even if they are using the same value. The parameters also must be placed in the order that they appear in the statement. SQL Bind Variables / Parameters
  • 26. www.regoconsulting.com Phone: 1-888-813-0444 26 ● Very Useful if you need your updates to be “All or Nothing” <sql:transaction dataSource="${clarityDS}"> <core:set value="0" var="errorCnt"/> <core:catch var="sqlException"> <sql:update escapeText="0" var="updateCnt"> <!-- SQL UPDATE --> </sql:update> </core:catch> <core:if test="${!empty sqlException}"> <core:set value="1" var="errorCnt"/> </core:if> <!-- COMMIT OR ROLLBACK SQL TRANSACTION --> <core:choose> <core:when test="${errorCnt == 0}"> <!-- COMMIT TRANSACTIONS --> <sql:update>COMMIT</sql:update> </core:when> <core:otherwise> <!-- ROLLBACK TRANSACTIONS --> <sql:update>ROLLBACK</sql:update> </core:otherwise> </core:choose> </sql:transaction> SQL Transaction
  • 27. www.regoconsulting.com Phone: 1-888-813-0444 27 ● Use this tag to insert status messages into the process engine log table ● Very useful when debugging scripts ● Avoid using too many logging statements, as it can impact performance ● Different levels of logging – INFO, WARN, ERROR <gel:log level="INFO">This is an example log message.</gel:log> Logging Messages
  • 28. www.regoconsulting.com Phone: 1-888-813-0444 28 Use the GEL fault-handling tags to catch exceptions and exit gracefully when a process failure occurs. Use the <core:catch> tag to capture exceptions into a variable. Outside of the catch tags, you can check the variable and write it to the console. Example: <core:catch var="sqlException"> <sql:query dataSource="${clarityDS}" escapeText="0" var="result"> <![CDATA[ SELECT r.id, FROM srm_resources r ]]> </sql:query> </core:catch> <core:if test="${!empty sqlException}"> <gel:log level="ERROR">Exception: ${sqlException}</gel:log> </core:if> Exceptions
  • 29. www.regoconsulting.com Phone: 1-888-813-0444 29 CA PPM Environment: http://54.193.48.58:8081/niku/nu#action:homeActionId Username: regou Password: Clarity123 Note: When creating processes, please distinguish your process from others by using your name in the process name and id Example: Hands On Exercises
  • 30. www.regoconsulting.com Phone: 1-888-813-0444 30 ● URLs are not set up correctly in the properties.xml file. This means that if you need to reference the URL, you’ll have to hard-code it. Example: <gel:parameter var=“URL" default="http://54.193.48.58:8081"/> ● Caching Issues Limitations to Rego U Environment
  • 31. www.regoconsulting.com Phone: 1-888-813-0444 31 Create a process that uses a GEL script to update the following fields on the project object: Approved By (rego_appr_by): Resource that started the process Approval Date (rego_appr_date): Today’s Date Note: Environment is an Oracle environment Approved By field uses the Resource Browse lookup (srm_resources.id) Exercise #1
  • 32. www.regoconsulting.com Phone: 1-888-813-0444 32 SQL to update project fields: UPDATE odf_ca_project ocp SET ocp.rego_appr_date = sysdate, ocp.rego_appr_by = (SELECT r.id FROM bpm_run_processes brp JOIN srm_resources r ON brp.initiated_by = r.user_id WHERE brp.id = ?) WHERE ocp.id = ? Exercise #1 Hint
  • 34. www.regoconsulting.com Phone: 1-888-813-0444 34 By including the SOAP and XOG namespaces in GEL scripts, you give GEL the ability to communicate with the XOG web service. You must package each invocation in a proper SOAP envelope. The following steps must be used within a GEL script to communicate with the XOG web service: ● Include the proper namespaces ● Obtain a session ID ● Create the XML file to send ● Execute the XOG ● Parse the Results ● Logout SOAP / XOG
  • 35. www.regoconsulting.com Phone: 1-888-813-0444 35 <gel:script xmlns:core="jelly:core“ xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary“ xmlns:xog="http://www.niku.com/xog" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel ope/"> XOG - Include the proper namespaces
  • 36. www.regoconsulting.com Phone: 1-888-813-0444 36 <!-- Get sessionId by username --> <gel:parameter var="username" default="admin"/> <core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId" /> <core:invokeStatic var="userSessionCtrl" className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" /> <core:set var="secId" value="${userSessionCtrl.init(username, secId)}"/> <core:set var="XOGUsername" value="${secId.getUserName()}"/> <core:set var="sessionID" value="${secId.getSessionId()}"/> <core:choose> <core:when test="${sessionID == null}"> <gel:log level="ERROR"> Unable to obtain a Session ID. </gel:log> </core:when> <core:otherwise> <!-- Execute XOG --> </core:otherwise> </core:choose> XOG - Obtain a Session ID
  • 37. www.regoconsulting.com Phone: 1-888-813-0444 37 Example: <gel:parse var="userXML"> <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd"> <Header action="write" externalSource="NIKU" objectType="user" version="13.2.0.472"/> <Users> <User externalId=" " isLDAP="false" uiThemeDefaultPartitionCode=" " userLanguage="English" userLocale="en_US” userName="${row.userName}" userStatus="${row.userStatus}" userTimezone="America/Los_Angeles" userType="INTERNAL"> <PersonalInformation emailAddress="${row.email}" firstName="${row.firstName}" lastName="${row.lastName}"/> <Resource resourceId="${row.resourceId}"/> <Groups/> </User> </Users> </NikuDataBus> </gel:parse> XOG - Create the XML File
  • 38. www.regoconsulting.com Phone: 1-888-813-0444 38 <!-- Execute XOG --> <soap:invoke endpoint=“internal" var="result"> <soap:message> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog"> <soapenv:Header> <xog:Auth> <xog:SessionID>${sessionID}</xog:SessionID> </xog:Auth> </soapenv:Header> <soapenv:Body> <gel:include select="$userXML"/> </soapenv:Body> </soapenv:Envelope> </soap:message> </soap:invoke> XOG - Execute the XOG
  • 39. www.regoconsulting.com Phone: 1-888-813-0444 39 <!-- Parse Results --> <gel:set asString="true" select="$result//XOGOutput/Status/@state" var="XOGState"/> <core:choose> <!-- Success --> <core:when test="${XOGState == 'SUCCESS'}"> <gel:set asString="true" select="$result//XOGOutput/Statistics" var="xogStats"/> <gel:log level="INFO">User XOG Stats: ${xogStats} </gel:log> </core:when> <!-- Failure --> <core:otherwise> <gel:log level="WARN"><gel:expr select="$userXML/"/></gel:log> <gel:log level="ERROR"><gel:expr select="$result/"/></gel:log> </core:otherwise> </core:choose> XOG - Parse the Results
  • 40. www.regoconsulting.com Phone: 1-888-813-0444 40 <!-- Logout XOG--> <soap:invoke endpoint=“internal" var="result"> <soap:message> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog"> <soapenv:Header> <xog:Auth> <xog:SessionID>${sessionID}</xog:SessionID> </xog:Auth> </soapenv:Header> <soapenv:Body> <xog:Logout/> </soapenv:Body> </soapenv:Envelope> </soap:message> </soap:invoke> XOG - Logout
  • 41. www.regoconsulting.com Phone: 1-888-813-0444 41 Create a process that can be initiated from a custom object for a Project Request that will XOG in a new project Exercise #2 • Create project using the Name and ID of the Project Request
  • 42. www.regoconsulting.com Phone: 1-888-813-0444 42 Sample Project XOG: <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd"> <Header version="6.0.11" action="write" objectType="project" externalSource="NIKU"/> <Projects> <Project name="Test Project" projectID="PR1234" /> </Projects> </NikuDataBus> SQL to get Project Request Name and ID: SELECT pr.code prjCode, pr.name prjName FROM odf_ca_rego_prj_req pr WHERE pr.id = ? Exercise #2 Hint
  • 44. www.regoconsulting.com Phone: 1-888-813-0444 44 GEL can open a file (and if it is an XML file or a comma-delimited file, parse out all the nodes and attributes), read the file, and write to it. It can also perform FTP operations on files. It cannot, however, create a directory to put files in, move files around, or delete files after it is done with them. File Operations
  • 45. www.regoconsulting.com Phone: 1-888-813-0444 45 <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:files="jelly:com.niku.union.gel.FileTagLibrary"> <gel:parameter var="vFileName" default="/fs0/clarity1/share/RESOURCES.CSV"/> <files:readFile fileName="${vFileName}" delimiter="|" var="vResourceData" embedded="false"/> <core:forEach items="${vResourceData.rows}" var="row" begin="1" end="10"> <gel:log level="INFO"> Resource Last Name: ${row[0]} </gel:log> <gel:log level="INFO"> Resource First Name: ${row[1]} </gel:log> </core:forEach> </gel:script> File Operations – Read File
  • 46. www.regoconsulting.com Phone: 1-888-813-0444 46 <file:writeFile delimiter="," embedded="false" fileName=" Resources.csv "> <sql:query dataSource="${clarityDS}" escapeText="0" var="result"> <![CDATA[ SELECT u.first_name firstName, u.last_name lastName, u.user_name userName FROM cmn_sec_users u WHERE u.user_status_id = 200 ]]> </sql:query> <core:forEach items="${result.rows}" trim="true" var="row"> <file:line> <file:column value="${row.userName}"/> <file:column value="${row.lastName}"/> <file:column value="${row.firstName}"/> </file:line> </core:forEach> </file:writeFile> File Operations – Write File
  • 47. www.regoconsulting.com Phone: 1-888-813-0444 47 GEL scripts are often used to send emails. Using a GEL script notification allows for a lot more flexibility than sending an action item. There are two types of email tags, <gel:email> and <email:email>. It is recommended to use the <gel:email> tag where possible. Email
  • 48. www.regoconsulting.com Phone: 1-888-813-0444 48 <gel:email> ● Email server information is derived from the properties.xml of the installation. ● Supports HTML Example: <gel:script xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"> <gel:email from="clarity-do-not-reply@ca.com" subject="Clarity - Test Email" to="john@gmail.com"> <![CDATA[ This is a test email. <br/> <br/> ------------------------------------------------------------------- <br/> This is an automated message, please do not reply. ]]> </gel:email> </gel:script> Email cont.
  • 49. www.regoconsulting.com Phone: 1-888-813-0444 49 <email:email> ● Mail Server must be specified within the tag ● Does not support HTML ● Supports Attachments Example: <gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:email="jelly:email"> <core:invokeStatic className="java.lang.System" method="getenv" var="NIKU_HOME"> <core:arg value="NIKU_HOME"/> </core:invokeStatic> <gel:parse file="${NIKU_HOME}/config/properties.xml" var="properties"/> <gel:set asString="true" select="$properties/properties/mailServer/@host" var="mailServer"/> <email:email to="john@gmail.com" from="clarity-do-not-reply@ca.com" subject=“app-ca.log file" server="${mailServer}" attach="${NIKU_HOME}/logs/app-ca.log"> App-ca.log File </email:email> </gel:script> Email cont.
  • 50. www.regoconsulting.com Phone: 1-888-813-0444 50 Write a script that will email a list of all active projects with managers that are not active users in CA PPM to the resources within the following group: Exercise #3
  • 51. www.regoconsulting.com Phone: 1-888-813-0444 51 SQL to get Resources in Group: SELECT r.first_name || ' ' || r.last_name resName, r.email resEmail FROM cmn_sec_user_groups ug JOIN cmn_sec_groups g ON ug.group_id = g.id AND g.group_code = 'regou_gel_script' JOIN srm_resources r ON r.user_id = ug.user_id SQL to get Projects: SELECT i.id prjId, i.code prjCode, i.name prjName, r.full_name prjMgr FROM inv_investments i JOIN inv_projects ip ON ip.prid = i.id AND ip.is_template = 0 AND ip.is_program = 0 AND (i.purge_flag = 0 OR i.purge_flag IS NULL) JOIN odf_ca_project ocp ON i.id = ocp.id JOIN cmn_sec_users u ON i.manager_id = u.id AND u.user_status_id != 200 JOIN srm_resources r ON u.id = r.user_id Send Emails from the following email address: technical@regoconsulting.com Exercise #3 Hint
  • 53. www.regoconsulting.com Phone: 1-888-813-0444 53 ● If a variable can be changed by an admin, or stores a password, use the <gel:parameter> tag instead of <core:set> ● Comment your code ● Properly format and indent your code ● Place all code within the <gel:script> tags, even comments ● Avoid excessive logging, but keep enough for debugging purposes ● When possible, pull server info from properties file on server Example: <core:invokeStatic className="java.lang.System" method="getenv" var="NIKU_HOME"> <core:arg value="NIKU_HOME"/> </core:invokeStatic> <gel:parse file="${NIKU_HOME}/config/properties.xml" var="properties"/> <gel:set asString="true" select="$properties/properties/webServer/webServerInstance[@id='app']/@sslEntryUrl" var="URL"/> Best Practices
  • 54. www.regoconsulting.com Phone: 1-888-813-0444 54 ● Integrations with HR ● Integrations with Financial systems ● Timesheet Notifications ● Updating Resource Rights ● What have you used GEL scripts for? Real Life Examples
  • 55. www.regoconsulting.com Phone: 1-888-813-0444 55 Thank you. Questions Contact US 888.813.0444 Email Contact info@regoconsulting.com Web Site www.regoconsulting.com