Whitepaper on using the Javascript API feature of Oracle Talent Acquisition Cloud (formerly called as Taleo Enterprise Edition) to drive field level validations and calculations.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Field level validations in Taleo using Javascript API
1. Driving field level validations using
Javascript API in Oracle Talent Acquisition
Cloud
Jiju Vengal
Oracle Consulting
www.peoplesofthrms.blogspot.com
2. Table of Contents
1 INTRODUCTION..........................................................................................................3
2 Understanding the javascript api..............................................................................4
3 APPLICATION OF javascript functionS in tee 14a ..................................................5
3.1 Calculating and Setting offer components....................................................................5
4 CONCLUSION .............................................................................................................9
3. 1 INTRODUCTION
One of the common requirements in a number of Taleo Enterprise Edition implementations, is the need
to set the value of specific fields based on the value of other fields in a form. A typical example of this
is the need to calculate the components of salary based on the basic salary entered in the offer grid.
The traditional solution for such a requirement is to use Taleo Connect Client to extract data from a
form, carry out data manipulation and import the data back into the specific fields.
An elegant alternative to the above approach is the use of delivered Javascript APIs within Taleo
Enterprise Edition to manipulate data and populate required fields, from within the browser session
itself. This approach brings forth the following advantages:
a) Data manipulation can be carried out at the time of working on a form itself – thereby providing
real time calculation and validation of data.
b) Business users can invoke the javascript directly from the browser, thereby eliminating any
need to involve IT to run TCC scripts.
c) Javascript is a common and powerful language, thus complex logic for data manipulation can
be implemented using this method.
This paper examines the Javascript API functionality that is available in Taleo Enterprise Edition 14A
and provides examples of implementing the Javascript API for field manipulation.
4. 2 UNDERSTANDING THE JAVASCRIPT API
Taleo Enterprise Edition provides a number of Javascript functions within the Candidate, Requisition and Offer forms.
While the support of Javascript on Offer grid is available only from version 14A, prior versions support Javascript
functions on Candidate and Requisitions forms. In this paper, the functions available in 14A will be detailed.
The primary purpose of the Javascript APIs is to provide a mechanism for users to interact with the data in the forms
and apply customer specific logic. The following main Javascript functions are available in version 14A
Function Purpose Example syntax
getLoggedInUserAttribute Returns the value of an attribute of
the user currently logged in
Recruiting Center
Takes as input the ID of the
attribute for which to return the
value (ex: loginname,
employeeId)
javascript:getLoggedInUserAttribute("loginname");
viewSource Opens a new page with a list of all
the fields that can be interacted
with.
javascript: viewSource();
getTextInControl Returns the value of a specific
field in the form. This function can
be utilised to extract the value of a
field in a form.
javascript: getTextInControl("requisitionTitle");
setTextInControl Sets the value of a specific field in
a form. This function can be used
to override the value of a field in a
form. It is to be noted that not all
fields in a form can be
manipulated using this function.
To see the fields that can be set a
value on, use the “viewSource”
function to first retrieve the list of
fields in a form and the attribute
whether a value can be set or not.
javascript: setTextInControl("requisitionTitle", “new
value");
As can be seen above, the various Javascript functions can be effectively utilised to manipulate data that is available in
a Requisition, Candidate or Offer forms. The two primary functions of use will be:
(a) getTextInControl
(b) setTextInControl
getTextInControl can be utilised to read data from a specific field on the form and extract the information. This
information can be utilised further to manipulate data in a form or be used to write to a file.
setTextInControl is extremely useful, as it provides us with the ability to programmatically manipulate data on a form.
With the programming capability provided by Javascript, this function can be used to set a value to a field, based on
complex calculations.
5. 3 APPLICATION OF JAVASCRIPT FUNCTIONS IN TEE 14A
The Javascript functions can be invoked directly on the browser, using the Bookmark or Favourite functionality available
in most browsers. Most browsers support the ability to add a javascript function call as a bookmark/favourite. Once this
is done, users can simply execute the script by clicking on the bookmark when the user is in the appropriate form in
TEE. The below section details examples on using the Javascript API in TEE.
3.1 Calculating and Setting offer components
Problem Statement:
In many countries, the various components of salary is calculated based on the base salary. Thus, it might be
required to automatically calculate the components once the base salary is entered.
Let us take a simple example where there is a salary component called “Provident Fund” which is calculated as 12 %
of the basic Annualized Salary. A screenshot of the offer grid and relevant fields is given below:
The requirement is that the value of Provident Fund field should be automatically calculated based on the value
entered in the Annualized Salary field.
Solution Approach:
The solution can be broken down into the following steps:
(a) Use the getTextInControl Javascript function to retrieve the value entered in the Annualized Salary field.
(b) Multiple the value returned by getTextInControl by 0.12
(c) Use the setTextInControl Javascript function to set the value of the Provident Fund field, to the value
calculated in step (b).
Sample Javascript code:
The Javascript code that can be used to carry out the above requirement is given below:
javascript:(function()
{var x= getTextInControl("salary");
var y=x * 0.12;
setTextInControl("EBA_5fName_5fOUDF",y);}
())
6. Details of the code is given below:
(a) The function getTextInControl is used to read the value in the field salary and return to variable “X”. “Salary”
is the field id corresponding to the “Annualized Salary” field.
(b) Variable “X” which holds the value of Annualized Salary is multiplied by 0.12 and the result is stored in
variable “Y”.
(c) The function setTextInControl is used to set the value of “Provident Fund” field with the value present in
variable “Y”.
(d) “EBA_5fName_5fOUDF” is the field id corresponding to the “Provident Fund” field.
How to get the Field Id of the fields on a form?
Use the Javascript function “javascript: viewSource();” to open up a new page with the Field Ids of the fields on
a form that can be manipulated using the Javascript API.
Adding the code as a Bookmark:
To execute the above code and to carry out automatic calculation of provident fund field, it is required to add the
above code as a Bookmark on a browser, in this case Mozilla Firefox. The steps to add a bookmark will vary based on
the browser being used. Adapt the appropriate methodology for the browser of your choice.
The following steps can be followed to add as a bookmark:
(a) Open any browser, let’s say Mozilla Firefox
(b) Click on the option to “Show All Bookmarks”
(c) Select the “New Bookmark” option:
7. (d) Enter an appropriate name and paste the javascript code in the “Location” field. In other browsers, location
field could correspond to URL. Paste in the appropriate field.
(e) Click on “Add” to add the bookmark.
Seeing the API in action:
In this section, we will see how to invoke the API to automatically calculate the value of the Provident Fund field in the
offer gird.
(a) Access the Offer Grid in Edit mode of a candidate:
(b) As can be seen above, Annualized Salary has been entered. Next step is to use the Bookmark to
automatically calculate the value in Provide Fund (PF) field.
8. (c) Access the Favourite/Bookmark menu and click on the added Bookmark that contains the Javascript to
calculate value of the Provident Fund field. Click on the Bookmark.
(d) After clicking on the Bookmark, it will be seen that the calculated value is automatically populated in the
“Provident Fund” field. A sample screenshot is given below:
As can be seen from this example, the Javascript API method provides a real time means of updating data in a form.
This can be carried out by business users simply by clicking a browser bookmark and thus is an efficient mechanism
to handle data manipulations on forms.
9. 4 CONCLUSION
The Javascript API is a powerful tool that can aid in the real time interaction with data in Requisition, Candidate and
Offer Forms. This method can be effectively utilised to provide elegant solutions to requirements which require real time
manipulation of data in the above three forms. Over and above the business scenario detailed in this paper, there are
a number of use cases where this feature can be utilised. Some of the potential use cases are detailed below:
(a) Extraction of information from forms
(b) Validation of data on forms, including overriding manually entered data with calculated values
(c) Issuing warning/error messages based on field validations
Consultants and System Administrators are encouraged to make use of this functionality to extend the features of the
product and to drive up end user productivity.