- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 10:31 PM
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).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 08:19 AM
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>
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 11:24 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 11:40 PM
Hi @SudhirG
I have added the line but I am not getting the value in the pop up dialog box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 12:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 03:53 AM
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