Highlighted
Established Member..
Established Member..
285 views

how to coppy approvallog.comments data to html temaplates

Hi,

We are setting up new templates to email requesters the reason when their requests are denied by the line manager (I know they can see this is the SRC, but they are lazy).

I need to setup a lookup for the comments in the ApprovalLog.Comments field when ApprovalLog.Action is Denied.  I know this is done in JavaScript and we have tried this, but it does not seem to pull any data.

var deniedstatus= vars.$l_file.approvallog_action;
var comments = vars.$l_file.approvallog_comments;
if (deniedstatus =="Denied") {
comments;

0 Likes
2 Replies
Highlighted
Established Member..
Established Member..

Re: how to coppy approvallog.comments data to html temaplates

The bottom of my message got cut of.

I think the vars.$l_file is not referencing correctly.  How do we lookup the ApprovalLog table and pull fields into the htmltemplate?

Thank you for your assistance.

 

 

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: how to coppy approvallog.comments data to html temaplates

I do not have a Service Manager instance in front of me, so this is off the top of my head, but something like this should work:

The notification record line which calls the htmltemplate should have a condition like approval.status in $L.file="denied" and not same(approval.status in $L.file,approval.status in $L.file.save).

In the expressions tab of the htmltemplate, you should create an array variable - I'll call it approvalLog. The approvalLog variable should be populated thusly:

var approvalLog = new Array();
var log = new SCFile("ApprovalLog");
//I *think* number and number are the correct fields; make sure you check them:
//(the first "number" is the field on ApprovalLog; the second "number" is on request) var logRc = log.doSelect("number=\"" + record.number + "\""); while (logRc == RC_SUCCESS) { //Check the fieldname in ApprovalLog file of the approver who denied: approvalLog.push(log.approver); //Check the fieldname in ApprovalLog file of the date/time when the denial occurred: approvalLog.push(log.date); //Check the fieldname in ApprovalLog file of the comments given for the denial: approvalLog.push(log.comments); logRc = log.getNext(); }

As I indicated in the commented lines, make sure you double-check that these fields are the correct ones for the request (number) and the ApprovalLog (number, approver, date, comments).

Then, in the HTML Source tab of the htmltemplate, you can include the newly-populated variable as {approvalLog} wherever you want it to appear.

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.