Servicely Administration
Scripting
UI Event
5 min
a ui event automates business logics on a servicely table’s form and/or fields as they are loaded or as you interact with them on your web browser, i e doing field updates or saving your changes on the form it runs on the client side (your computer’s web browser) it can call docid pfjtclem zcu8ktp8zjw to run server side functions (also refer to docid\ latfchaaxu1wqcrr1vn0p ) it has access to the current record displayed on the form it has access to classes and functions within client accessible application properties (refer to docid\ ltoo4wlb8le r0q20fndx ) javascript knowledge is required creating a ui event true 248,228 2753530166881,799 5920036422897,801 1326433410222 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type examples make assignee required only when status is not new for a viewaspect called “servicedesk” true 406,1671 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type default an incident’s location based on requestor’s location data, using a controller this requires the use of a controller as we need to query an incident’s requestor user record and get their location true 412,1665 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type docid pfjtclem zcu8ktp8zjw “userinfocontroller” script referenced in the ui event’s script in above example, can look like the following (variable “locationid” is what the controller returns and the ui event makes use of) answer = {}; // query the user table for the record with the provided userid parameter if (userid) { let userrec = table("user", userid); if (userrec) { if (userrec location hasvalue()) { answer locationid = userrec location value(); } } } answer; default an incident’s location based on requestor’s location data, using a rest call the ui event can be configured the same way per the above example with a controller, but the ui event script should look like the following instead //assuming there is a requestor, form is not loading, location is not already set if (!isloading && current requestor hasvalue() && !current location hasvalue()) { rest get("user", current requestor(), { fields "location" }) then(response => { current location(response data location); }); }