Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Default Values for an HTML field.

RYang
Kilo Contributor

Hi,

I have a requirement where a a set of fields needs to be added to our change management form in a 3 x 5 table. Because ServiceNow can only perform splits that allows for two columns at a time it was suggested that we create an HTML form and add the "table" within that field using HTML formatting.

I am having some trouble creating this HTML form within the our "high risk activities" field by default. I tried using a before business rule with the following script:


var high_level = '<table>
<tr>
<td>Header 1</td>
<td>Header 2</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
</tr>
</table>;'
current.u_high_level =high_level;
current.update();


But it returns an error or doesn't populate anything in the field. Would anyone be able to help? How do I create default HTML formatting for a field for every new record?

Thanks!
1 REPLY 1

Miguel Caldero3
Mega Expert

I'm going to assume that high risk activities is an html field.
When you create a variable, there is default value field. Put your html code in there.
Save the changes.
Create a new change record and you should see your html in the high risk activities field.