Add description to an approval request in a request item.

Michael Rossau
Tera Contributor

Hi,

I need to add a description to an approval request, so that the approver receives instructions on what they should approve or reject.

The approval request is linked to a request item.

 

Any good solution?

2 REPLIES 2

Brian Lancaster
Tera Sage

In ours we include the name of the item that they need to approve and then we call a mail script with the below code to list out the filled out variables. The only variables that will not show is if you are using a multi-row variable set. This mail script is setup to be used with multiple tables where variables could we displayed.

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {
	var item_sys_id;
	var tableName = current.getTableName();		
	if(tableName == 'sysapproval_approver'){
		item_sys_id = current.sysapproval;		
	} else if (tableName == 'sc_task'){
		item_sys_id = current.request_item.sys_id;
	} else if(tableName == 'sc_req_item'){
		item_sys_id = current.sys_id; 
	} else{
		item_sys_id ='';
	}
	//gs.log("SYS ID : "+item_sys_id);
    var item = new GlideRecord("sc_req_item");
    item.addQuery("sys_id", item_sys_id);
    item.query();
    while (item.next()) {
        template.print("<div style='font-size:12pt;font-family:Arial, Helvetica, sans-serif;'><span><b>Options</b>:</span><br />");
        var keys = [];
        var set = new GlideappVariablePoolQuestionSet();
        set.setRequestID(item.sys_id);
        set.load();
        var vs = set.getFlatQuestions();
        for (var i = 0; i < vs.size(); i++) {
            if (vs.get(i).getLabel() != '') { //This displays all of the variables (answered/unanswered)
                              
                var val = vs.get(i).getDisplayValue();
                if (val != '') {
					template.space(4);
                    template.print(vs.get(i).getLabel() + " : " + val + "<br />");
                }
            }
        }
        template.print("</div>");
    }
    // Add your code here
})(current, template, email, email_action, event);

 

This helps a little but you still have a lot of manager who always approve the request.

Michael Rossau
Tera Contributor

Hi Brian,

Thanks, I will try this setup.