Page Scripts

Page Scripts allows you to customize the application page-wise as per your requirement. You can modify the UI elements as well as the functionalities of a page in the application using page scripts for users. For example, you can hide certain buttons in the requests list view or request details page for users. You can also choose to add new widgets, videos, web pages, and forms for requesters or technicians across pages in modules. 

To execute a page script, you need to first define a rule and configure a condition.

Some basic customization scripts such as for Hide Actions, Show Actions, Add Buttons, Add Elements, Add Widgets, and Hide Unanswered Fields are given by default. 

Some sample scripts in action

Sample 1: Hiding Actions Menu

For example, you can hide the Actions menu for requests that are pending approval by doing the following:

Set the Rule application to Applies to All Users

Set the Rule Event to Request details page

Set the condition as: 

Approval status is Pending Approval

Under Actions, click Write Custom Script. Input $CS.hideElement("actions"); on to the script code. 


Click Save Script. The Actions menu for requests that are pending approval will not be shown.  
 

 

Sample 2: Add New buttons

Similarly, you can add new buttons using page scripts. For example, you can add "Create New Jira Ticket" button within the request details page for requests in Desktop Hardware category by doing the following:

 

Set the Rule application to Applies to All Users.

Set the Rule Event to Request details page. 

Set the condition as:

Category is Desktop Hardware

 Under Actions, click Write Custom Script. Input the below code.

$CS.addButton("edit", "Create JIRA Ticket", function(){
window.location.href="/WorkOrder.do";
}
,{
"class":"btn btn-default btn-xs ml10"}
);


Click Save. The Create Jira Ticket button will be displayed in the requests with the Desktop Hardware category