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

SudhirG
Kilo Sage

Hi @Priyadharashin1 ,

If you are rendering UI page with the glideModal add below line to the script. Using 'setPreference()' method we can pass the parameter and access in the UI page.

var gModal = new GlideModal("ui_page_name");
gModal.setPreference('sys_parm1', value1);  // pass checkbox A value
gModal.setPreference('sys_parm2', value2);  // pass checkbox B value
gModal.render();

UI Page:

To access parameters passed in the UI page please check below script. 

<g:evaluate var="jvar_checkboxA" expression="RP.getParameterValue('sys_parm1')"/>
<g:evaluate var="jvar_checkboxB" expression="RP.getParameterValue('sys_parm2')"/>


<input type="checkbox"   value="$[jvar_checkboxA]">
<input type="checkbox"   value="$[jvar_checkboxB]">

 

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

Thanks,

Sudhir G

  

Hi @SudhirG 

I have added the line but I am not getting the value in the pop up dialog box.

Hi @Priyadharashin1 ,

Can you try below code in UI page.

<j:if test="${jvar_checkboxA == 'true'}">
		<input type = "checkbox" name="mim-propose-catsystem" id="mim-propose-catsystem"  checked="true"></input>
	</j:if>
	<j:if test="${jvar_checkboxA == 'false'}">
		<input type = "checkbox" name="mim-propose-catsystem" id="mim-propose-catsystem"></input>
	</j:if>

 

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

Thanks,

Sudhir G

Hi @SudhirG ,

 

I tried this but the checkbox disappears even if the field is true or false and I think the if condition is failing here

 

Priyadharashin1_0-1685443989688.png