The CreatorCon Call for Content is officially open! Get started here.

How to populate variable values into an html field on the task form.

daniellebell
Tera Guru

Hello all, I am stuck on how to solve this problem and after much searching, have been unable to find a solution, so I'm hoping someone here can help.

We have a catalog item that captures several pieces of information which are then used by the assignment team to structure the body of an email that is then sent out. The assignment group, in this case, does not have a full ITIL license, so we are working on a custom task table without a working variable formatter.

We've modified the generated task form to include an HTML field and are using a business rule to show the correct email template based on the value of another custom field that is populated in the workflow from a variable. There is a business rule that is running to display the correct email template in the HTML field based on the selection in another field. 

All of that is working as expected, however, I cannot seem to get values from other variables into the HTML template. I think I'm running into an issue with javascript and HTML not wanting to play nice, but am truly at a loss as to what else to try.  I've attached an image of the section of the task form that holds the HTML field and two additional fields that are being populated from the workflow.

Any help is greatly appreciated!

find_real_file.png

 

1 ACCEPTED SOLUTION

Hi Vikky - thanks for your time on this.  This does look like it will work to get the variable values into the HTML field, but I"m running into trouble when attempting to preserve the table layouts.  Any advice on how to keep the visuals?  For instance, my existing HTML code defines text alignment and table layouts but when I attempt to enter that into the BR script I am getting an error:

find_real_file.png

I'm assuming there is some other way to code HTML within JavaScript like this, but have not been able to find the correct method.

View solution in original post

6 REPLIES 6

Vikas-Malhotra
Mega Guru

Hi,

 

Kindly try to render the variables like this ${u_response_reply_here}.

 

Thanks

This is what returns when I add that syntax to the business rule: 

find_real_file.png

 

I've also tried adding the script tag to the HTML with the same result:

find_real_file.png

 

 

Hi,

 

Can you try this into your BR:

var html_text = current.variables.<Variable Name>;

current.<HTML Field name> = "<p>"+html_text+"</p>";

Hi Vikky - thanks for your time on this.  This does look like it will work to get the variable values into the HTML field, but I"m running into trouble when attempting to preserve the table layouts.  Any advice on how to keep the visuals?  For instance, my existing HTML code defines text alignment and table layouts but when I attempt to enter that into the BR script I am getting an error:

find_real_file.png

I'm assuming there is some other way to code HTML within JavaScript like this, but have not been able to find the correct method.