0

Client Script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
     var usrInfo = new GlideAjax('x_edc_irs.ISRApprovals');
    usrInfo.addParam('sysparm_name', 'getEmailTemplate');
    usrInfo.addParam('sysparm_table', "sysid of record");
    usrInfo.addParam('sysparm_template', newValue);
    usrInfo.getXMLAnswer(getBase);
      //Type appropriate comment here, and begin script below
 }
 function getBase(answer) {
    g_form.setValue("email_field", answer);
}

Script Include:

getEmailTemplate: function() {
         var ip = this.getParameter("sysparm_template");
        var inputs = new Object();
        inputs.u_irs_template = ip;
        var dt = new sn_dt.DecisionTableAPI();
        var response = dt.getDecision('decision table record sysid', inputs);
        return response.result_elements.u_email;
    },

Querying a Decision Table from a Client Script
Working Code Edited question February 7, 2025