Scripts
Scripts
Ajax Scripts Enables the client to get data from the server to dynamically incorporate into a page without reloading the whole page.
Ajax Client Scripts request that information be returned, or that action be taken, or sometimes both
Ajax Server Scripts fulfill Ajax Client Script requests
Service Defines the display of a variable set or a catalog item (from the service catalog).
Catalog UI
policies
Client Scripts Used for making changes to the appearance of forms, displaying different fields based on values that are entered or other custom
options.
onLoad means the Client Script runs when the form or page is loaded
onChange means the Client Script runs when something specific gets changed AND also when the form or page loads
onSubmit means the Client Script runs when the form is submitted
Client Scripts can also be called by other scripts or modules, including UI policies.
Script actions Contains scripts which run when an event occurs, for example
approval is cancelled
change is approved
problem is assigned
Can have a condition which must be true for the script to run. Commonly used to call a Script Include.
Script Includes Contains scripts which can be functions or classes. These scripts run only when called by other scripts (often Business Rules).
Any server script which is complicated or reusable should be a Script Include (especially complicated Business Rules).
UI Actions Creates the ability to choose a specific action such as clicking a button or a link.
UI Context Defines which "right-click menu" will pop-up in which area, and the menu choices that will be available
Menus
Note: If you use a left-handed mouse configuration, right-click means "click the other button."
UI Macros Contains modular, reusable components that can contain Jelly and are called by UI pages. They also contain different types of sc
may be called multiple times on the same page.
UI Pages Used to create and display pages, forms, dialogs, lists and other UI components. Can be displayed on a standalone basis, or call
usable component, as part of a larger page.
Can contain
Client Scripts,
processing scripts (which are server scripts),
HTML,
Jelly,
UI Macros,
and also can call other scripts.
Note: Jelly turns XML into HTML.
UI Scripts Contains client scripts stored for re-use. Only used when called from other scripts.
Workflow Used to create or change a workflow. Scripts can be run at any point in a workflow, or different scripts can be run at different poin
editor
Scripts also can be found inside every workflow activity and can be modified (although do so with extreme caution).
BUSINESS RULE
UI Policy : if you want to make your form field "Mandatory" "Read Only" "Visible" based on some field condition or browser load then you
can simply use UI Policy here.
Let's take an example : i want to make work notes field mandatory based on the state field value. so this is a simple straight forward
requirement. so here i will go with UI Policy.
i will Create an UI Policy and set the filter condition State | IS | Resolved then in the UI Policy action i will set true for Work notes field.
If you have a similar requirement but the work notes field should be mandatory on form Submission then you have to use here onSubmit
Client script because in UI Policy you can either set it on field change or form load ( only in these two scenario you can run the UI Policy
).
But Client script can be run on either onLoad() , onChange() , onSubmit() or onCellEdit().
Client Side (Client Script):
return;
}
ga.addParam('sysparm_name', 'getCampus');
ga.addParam('sysparm_buildingid', g_form.getValue("u_building"));
ga.getXML(updateCampus);
function updateCampus(response) {
if (answer) {
} else {
g_form.setValue("campus", clearvalue);
}
var asu_GetLocationData = Class.create();
asu_GetLocationData.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCampus: function () {
if (loc.get(buildingid)) {
if (campus.get(loc.parent)){
var results = {
"sys_id": campus.getValue("sys_id"),
"name": campus.getValue("name")
};
return json.encode(results);
}
} else {
return null;
}
}
});