How to pass in a task description's HTML format in a Document Template Script?

2mustang
Tera Contributor

I am using the Document Template App and trying to create a Document Template Script to return the HTML format of a Requested Item's description into a HTML Document. 

 

(function runTemplateScript(target /*GlideRecord for target task*/, docTemplate /*GlideRecord for doc template*/ ) {

	var descHTML = target.description.getHTMLValue();
	return 	descHTML;

})(target, docTemplate);

 

The output when running a preview within the HTML document is my description with no formatting. I have not come across this issue with getHTMLValue() when ran in a background script

 

I have ran a background script with the same code and it does not seem to have any issues with the description formatting:

 

var ritmRCD = 'RITM0010004';
 
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', ritmRCD);
gr.query();
 
while(gr.next()){
var description = gr.description.getHTMLValue();
gs.info(description);
}

 

 

I have attached pictures of my RITM's description, a HTML Preview when running my script, and the output of the background script. 

0 REPLIES 0