Catalog Request Approval emails: Help with notification

velvet
Mega Guru

Currently we have the approval for the Request automatically being approved.   But we need an approval for the RITM, catalog item approved by the approving manager. For the RITM, it was setup to use the approval request email, with the change.itil.approve.role, which is incorrect, but with it firing off when approval.inserted we are getting the email but with the incorrect info or not all the info... So I want to user the Catalog Request Approval email, with the request.itil.approve.role that fires off when an approval.inserted.   The email is received when using that email template but not all the info is showing.   But what I have noticed is that when I preview this notification and put in a RITM is does not show the information, but when I put in a REQ to preview it shows the information that I need.   So how do I get the REQ info in the email when the RITM is sent for an approval.   Or what am I doing wrong...

When I preview a RITM

find_real_file.png

When I preview a REQ

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

One correction made. try this



<div>${mail_script:branded_email_header}</div>


<div>Short Description: ${sysapproval.short_description}</div>
<div>Priority: ${sysapproval.priority}</div>
<div>Requested For: ${sysapproval.requested_for}</div>
<div>Requested By: ${sysapproval.opened_by}</div>
<div>Total Price: ${sysapproval.price}</div>
<hr/>
<mail_script>
template.print("Summary of Requested items:\n");  
  var item = new GlideRecord("sc_req_item");


  if (current.sysapproval.sys_class_name == 'sc_request')
            item.addQuery("request", current.sysapproval);


  else


            item.addQuery("sys_id", current.sysapproval);
  item.query();
  while(item.next()) {
          template.print(item.number + ":   " + item.quantity + " X " + item.cat_item.getDisplayValue() + " at " +
    item.price.getDisplayValue() + " each \n");
          template.print("       Options:\n");
          var keys = new Array();
          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() != '') {
                    template.space(4);
                    template.print('         ' +   vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");


              }
          }
  }
</mail_script>
Comments:
${sysapproval.description}
<hr/>
${mailto:mailto.approval}
<hr/>
${mailto:mailto.rejection}
<hr/>
Click here to view Approval Request: ${URI}
Click here to view ${sysapproval.sys_class_name}:   ${sysapproval.URI}


<div>${mail_script:branded_email_footer}</div>



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

32 REPLIES 32

velvet
Mega Guru

This is still not working


velvet
Mega Guru

find_real_file.png


find_real_file.png


find_real_file.png


You need to replace the template with below. notice the one marked bold in the below script which I modified.



<div>${mail_script:branded_email_header}</div>


<div>Short Description: ${sysapproval.short_description}</div>
<div>Priority: ${sysapproval.priority}</div>
<div>Requested For: ${sysapproval.requested_for}</div>
<div>Requested By: ${sysapproval.opened_by}</div>
<div>Total Price: ${sysapproval.price}</div>
<hr/>
<mail_script>
template.print("Summary of Requested items:\n");  
  var item = new GlideRecord("sc_req_item");


  if (current.sysapproval.sys_class_name = 'sc_request')
            item.addQuery("request", current.sysapproval);


  else


            item.addQuery("sys_id", current.sysapproval);
  item.query();
  while(item.next()) {
          template.print(item.number + ":   " + item.quantity + " X " + item.cat_item.getDisplayValue() + " at " +
    item.price.getDisplayValue() + " each \n");
          template.print("       Options:\n");
          var keys = new Array();
          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() != '') {
                    template.space(4);
                    template.print('         ' +   vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");


              }
          }
  }
</mail_script>
Comments:
${sysapproval.description}
<hr/>
${mailto:mailto.approval}
<hr/>
${mailto:mailto.rejection}
<hr/>
Click here to view Approval Request: ${URI}
Click here to view ${sysapproval.sys_class_name}:   ${sysapproval.URI}


<div>${mail_script:branded_email_footer}</div>



Please mark this response as correct or helpful if it assisted you with your question.

velvet
Mega Guru

Ok thanks , I will try it... Also i think the consultant set up 1 approval email notification for all approvals no matter if it was for a REQ, RITM, CH, etc.   But I will let you know the outcome


velvet
Mega Guru

Sanjiv, I am not receiving the email now.   I need it to send the email when a approval request for a RITM.   But when i preview a REQ i get the info I need but not when I preview a RITM.   But now the email is not being sent....


find_real_file.png