Email approval script for standard change template

lando321
Tera Contributor

Hello,

I am trying to add more information to a standard change proposal template, but when i attempt to grab the CI from the change record, there's no value for the CI. Can anyone spot what i am doing wrong? Or if it is even possible to grab that value?

 

lando321_0-1696262743457.png

 

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
        /* Optional EmailOutbound */
        email, /* Optional GlideRecord */ email_action,
        /* Optional GlideRecord */
        event) {

        var changeRec = new GlideRecord(current.source_table); //instantiate a storage record on the change template table
        changeRec.get(current.document_id); //returns the sysID of the change template record 

			template.print("Number:" + " " + changeRec.number + "\n");
            template.print("Short Description:" + " " + changeRec.short_description + "\n");
			template.print("Opened By:" + " " + changeRec.opened_by.getDisplayValue() + "\n");

			var item = new GlideRecord('change_request');
			item.addQuery("cmdb_ci", current.cmdb_ci);
			item.query();
			if(item.next()) {

            template.print("Configuration Item:" + " " + item.cmdb_ci.getDisplayValue() + "<br />"); 
			}

            template.print("Please review the change details and provide your approval or rejection.\n\n" +

                "To approve or reject the change, click on the appropriate link below:\n\n" +

                "Approve: " + gs.getProperty('glide.servlet.uri') + current.getLink(true) + "&sysapproval=true&approval=approve\n" +

                "Reject: " + gs.getProperty('glide.servlet.uri') + current.getLink(true) + "&sysapproval=true&approval=reject");

        })(current, template, email, email_action, event);

 

0 REPLIES 0