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.

Show the field value from the incident form in the UI Page

Priyadharashin1
Tera Contributor

Hi All,

 

In Major Incident management, when the Incident is promoted as major incident, I need to show some additional fields(checkbox) in the pop window shown. and I have done that in UI Page. Now I need a solution to make the checkbox true based on the values selected in the form. (if the checkbox A is true in the form, then in the pop window it should be checked).

Priyadharashin1_2-1685424581104.png

 

 

 

1 ACCEPTED SOLUTION

@Priyadharashin1 

then it should work fine

try this once

<div class="form-group">
<div class="col-sm-10">
<label class="col-sm-2 control-label" for="mim-propose-catsystem">${gs.getMessage('checkbox A')}</label>
<g:evaluate var="jvar_checkboxA" expression="RP.getWindowProperties().cat_system"/>
<input type = "checkbox" name="mim-propose-catsystem" id="mim-propose-catsystem" checked="${jvar_checkboxA.toString()}"></input>
</div>
</div>

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

14 REPLIES 14

@Priyadharashin1 

are you sure the record has false value in that field -> g_form.getValue('u_cat_system')

did you check in alert?

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Yes, I am getting an alert in the form with the values either true or false.

@Priyadharashin1 

then it should work fine

try this once

<div class="form-group">
<div class="col-sm-10">
<label class="col-sm-2 control-label" for="mim-propose-catsystem">${gs.getMessage('checkbox A')}</label>
<g:evaluate var="jvar_checkboxA" expression="RP.getWindowProperties().cat_system"/>
<input type = "checkbox" name="mim-propose-catsystem" id="mim-propose-catsystem" checked="${jvar_checkboxA.toString()}"></input>
</div>
</div>

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

This now works as expected. Thank you.

SudhirG
Kilo Sage

Hi @Priyadharashin1 ,

Try with below script it should work.

UI Page HTML:

 

<g:evaluate var="jvar_checkboxA" expression="RP.getParameterValue('cat_system')"/>
<input type="hidden" id="checkbox_value" value="${jvar_checkboxA}"></input>

<input type ="checkbox" name="mim-propose-catsystem" id="mim-propose-catsystem"></input>

 

UI Page Client script:

 

var checkVal = document.getElementById('checkbox_value').value;
if(checkVal == 'true')
	document.getElementById('checkboxA').checked = true;
else if(checkVal == 'false')
	document.getElementById('checkboxA').checked = false;

 

Please, mark answer correct or helpful based on the impact.

Thanks,

Sudhir G.