Highlighted
Honored Contributor.
Honored Contributor.
529 views

Adding Approval Comments to html email template

Jump to solution

We are using approvals with the Service Catalog while the record is still an interaction. I have created an html email that will send if the record receives a denial, but I would like to include those approval comments or data from the approval log in the email.

these fields are in the incidents table :

Approval Comments field=$L.aplItem.comments

Approval Log field=action

I am unable to get the information to show in the email

We are using SM HPE 9.50 with Process Designer

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Adding Approval Comments to html email template

Jump to solution

Hi a2drew,

One option to display information from another record in the htmltemplate is to use the id of the interaction to query the ApprovalLog table and bring the Comments to a variable in the htmltemplate code. The code in the htmltemplate can be something like this:


var id="SD10114"
var aplog= new SCFile("ApprovalLog");
var rc=aplog.doSelect("unique.key=\""+id+"\"");
var comments="";
if (rc==RC_SUCCESS)
{
    comments=aplog.comments;
}

Note: The variable id, needs to be set based on your htmltemplate code.

the variable comments needs to be added in the html Source,

I hope this helps.

Best regards,

View solution in original post

3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Adding Approval Comments to html email template

Jump to solution

Hi a2drew,

One option to display information from another record in the htmltemplate is to use the id of the interaction to query the ApprovalLog table and bring the Comments to a variable in the htmltemplate code. The code in the htmltemplate can be something like this:


var id="SD10114"
var aplog= new SCFile("ApprovalLog");
var rc=aplog.doSelect("unique.key=\""+id+"\"");
var comments="";
if (rc==RC_SUCCESS)
{
    comments=aplog.comments;
}

Note: The variable id, needs to be set based on your htmltemplate code.

the variable comments needs to be added in the html Source,

I hope this helps.

Best regards,

View solution in original post

Highlighted
Honored Contributor.
Honored Contributor.

Re: Adding Approval Comments to html email template

Jump to solution

The expression I had was:

//Localize local module status value
var file_name = system.functions.filename($RECORD);
var _open = $RECORD.open;
var _approvalStatus = $RECORD.approval_status;

var open = lib.htmlemailtemplates.getLocalStatusValue($RECORD, _open)
var approval_status = lib.htmlemailtemplates.getLocalizedApprovalStatus(_approvalStatus);
var display= lib.MailUtil.isRequestDetailSectionDisplay();

//#######################
var interaction_id;
if (file_name === "incidents") {
  interaction_id = $RECORD.incident_id;
}
else if (file_name === "Approval") {
  interaction_id = $RECORD.unique_key;
}

var interaction_record = new SCFile("incidents", SCFILE_READONLY);
interaction_record.setFields(['title','description','contact.name','open','cartId']);
interaction_record.doSelect('incident.id="' + interaction_id + '"');
var service_recipient = interaction_record.contact_name;
var interaction_status = interaction_record.open;
var interaction_title = interaction_record.title;
var interaction_desc = interaction_record.description;

 

So would I add it in like this:?

//#######################
var interaction_id;
if (file_name === "incidents") {
  interaction_id = $RECORD.incident_id;
}
else if (file_name === "Approval") {
  interaction_id = $RECORD.unique_key;
}
var aplog= new SCFile("ApprovalLog");
var rc=aplog.doSelect("unique.key=\""+id+"\"");
var comments="";
if (rc==RC_SUCCESS)
{
    comments=aplog.comments;
}

var interaction_record = new SCFile("incidents", SCFILE_READONLY);
interaction_record.setFields(['title','description','contact.name','open','cartId']);
interaction_record.doSelect('incident.id="' + interaction_id + '"');
var service_recipient = interaction_record.contact_name;
var interaction_status = interaction_record.open;
var interaction_title = interaction_record.title;
var interaction_desc = interaction_record.description;

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: Adding Approval Comments to html email template

Jump to solution

Your solution was right, I just needed to update my id variable

From:

var rc=aplog.doSelect("unique.key=\""+id+"\"");

to:

var rc=aplog.doSelect("unique.key=\""+interaction_id+"\"");

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.