User Tools

Site Tools


ui_actions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ui_actions [12/30/2024 06:57] – created johnsonjohnui_actions [12/30/2024 06:58] (current) johnsonjohn
Line 1: Line 1:
 =====UI ACTIONS===== =====UI ACTIONS=====
 +----
 +
 +====Assign To Me ==== 
 +<code>
 +//Credit to: https://servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
 +
 +//Onclick: runClientCode();
 +//Condition: gs.hasRole('itil')&& gs.getUser().isMemberOf(current.assignment_group.toString())
 +
 +//Client-side 'onclick' function
 +function runClientCode(){
 + g_form.setMandatory("assigned_to",false);
 +//Call the UI Action and skip the 'onclick' function
 +gsftSubmit(null, g_form.getFormElement(), 'assignToMe'); //MUST call the 'Action name' set in this UI Action
 +}//Code that runs without 'onclick'
 +//Ensure call to server-side function with no browser errors
 +if(typeof window == 'undefined')
 +runBusRuleCode();
 +
 +//Server-side function
 +function runBusRuleCode(){
 + current.assigned_to = gs.getUserID();
 + current.update();
 + action.setRedirectURL(current);
 +}
 +
 +</code>
 ---- ----
  
ui_actions.1735570657.txt.gz · Last modified: 12/30/2024 06:57 by johnsonjohn

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki