FAFR to set priority based on other change fields

FAFR to set priority based on other change fields

Requirement:
Set priority based on 3 change fields.  i.e Change Additional field - "Coverage", "Impact" and "Urgency".

Steps to configure:
1.  Goto Admin > Change Templates > Field and Form Rules > On Field Change:  Urgency.
2.  Set Conditions as:  Coverage is not empty, Impact is not empty and Urgency is not empty.
3.  Execute Script:   Paste the attached script. Update the change additional field value as per your instance.



Script:
var Priority_Matrix = {
  "Coverage 4": {
    "Impact 4": {
      "Urgency 4": "Critical",
      "Urgency 3": "High",
      "Urgency 2": "Medium",
      "Urgency 1": "Low"
    },
    "Impact 3": {
      "Urgency 4": "High",
      "Urgency 3": "High",
      "Urgency 2": "Medium",
      "Urgency 1": "Low"
    },
    "Impact 2": {
      "Urgency 4": "Medium",
      "Urgency 3": "Medium",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 1": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    }
  },
  "Coverage 3": {
    "Impact 4": {
      "Urgency 4": "High",
      "Urgency 3": "High",
      "Urgency 2": "Medium",
      "Urgency 1": "Low"
    },
    "Impact 3": {
      "Urgency 4": "High",
      "Urgency 3": "Medium",
      "Urgency 2": "Medium",
      "Urgency 1": "Low"
    },
    "Impact 2": {
      "Urgency 4": "Medium",
      "Urgency 3": "Medium",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 1": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    }
  },
  "Coverage 2": {
    "Impact 4": {
      "Urgency 4": "Medium",
      "Urgency 3": "Medium",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 3": {
      "Urgency 4": "Medium",
      "Urgency 3": "Medium",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 2": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 1": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    }
  },
  "Coverage 1": {
    "Impact 4": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 3": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 2": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    },
    "Impact 1": {
      "Urgency 4": "Low",
      "Urgency 3": "Low",
      "Urgency 2": "Low",
      "Urgency 1": "Low"
    }
  }
};
var coverage = $CS.getText("UDF_CHAR1");  // Update with the change UDF field name as per your instance.
var impact = $CS.getText("IMPACT");
var urgency = $CS.getText("URGENCY");
$CS.setText("PRIORITY",Priority_Matrix[coverage][impact][urgency]); 

                  New to ADSelfService Plus?

                    • Related Articles

                    • Custom Module-Based Dependent Fields with FAFR

                      In the dynamic world of IT service management, form simplicity and accuracy play a major role in how smoothly requests are handled. However, many organizations face a recurring challenge—dependent field limitations within ServiceDesk Plus. Currently, ...
                    • Script to set fields from CSV using FAFR.

                      Works in 10604 Requirement: Load Data from CSV depending on the value selected in an additional field. Usecase: Assume there are 3 additional fields for a request template, namely, "Reference number", "Payment type and "Vendor". "Reference number" is ...
                    • How to diff of two Date& Time fields using FAFR

                      If you have two date and time additional fields or default fields, and if you want to capture the difference between those two fields in Hours and minutes, then use the below script to capture the value in an additional field, Under the respective ...
                    • How to create a change automatically based on a schedule

                      This is a sample python script that triggers the creation of a Change Request in ServiceDesk Plus using the Change API based on a schedule Note:  Attached script will not work beyond 11138 SDP Version. ​ A short guide on setting up python is ...
                    • Script to Populate User Additional Field under Incident Template using FAFR

                      The script load the Requester Name under Incident Additional field ( As a pick list), by choosing the requester name under additional field the script populates the user additional field value. * Kindly create two additional fields under Admin -> ...