Use both g_form and g_user methods in a Client Script

  1. Create a new Client Script
  2. Name: Lab 2.2 Confirm Major Incident Details
    Table: Incident [incident]
    UI Type: Desktop
    Type: onSubmit
    Active: Selected
    Inherited: Not Selected
    Global: Selected
    Description: Confirm initial P1 details are included if the incident creator is not a Major Incidend Manager
    
  3. Examine and write following script:
  4. function onSubmit(){
        if(g_form.getValue('impact') == 1 && g_form.getValue('urgency') == 1 && !g_user.hasRoleExactly('major_inc_mgr')){
            var ans = confirm("The customer is notified of all Priority-1 Incidents. Confirm base information is included before submitting this P1 incident.\n\nSelect Ok to submit, or Cancel to return to the record.");
    
            if(!ans){
                g_form.addInfoMessage("Incident not submitted");
                g_form.addInfoMessage("If base information is unavailable, use the 'Additional comments' field to document why it is missing");
                g_form.showFieldMsg('category', "Major Incident base field");
                g_form.showFieldMsg('cmdb_ci', "Major Incident base field");
                g_form.showFieldMsg('assignment_group', "Major Incident base field");
                g_form.showFieldMsg('short_description', "Major Incident base field");
            }
            return ans;
        }
    }
    
  5. Select Submit

results matching ""

    No results matching ""