- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 12:09 AM
Hello community,
I have a requirement that when the CAB required is checked the CAB date and CAB recommendation field should be visible. I have achieved the functionality using UI policy. However when the form load initially there is a gap(marked with red square) between two fields(CAB required and Outage required). Can you please suggest the code how to minimize the gap between two fields.
When unchecked:
When checked:
Code in UI policy:
Thanks & Regards,
Jagan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 01:30 AM
Hi @JaganN971616731 ,
In UI policy, there are two scripts: one that executes if a condition is met, and a second one that executes when the condition is not met. In the "Execute If False" script, you would write the opposite logic of the "Execute If True" script. Please check below example
Execute if true Script -
function onCondition() {
g_form.setDisplay('u_cab_date_time', true);
}
Execute if false Script -
function onCondition() {
g_form.setDisplay('u_cab_date_time', false);
}
When Form is Loaded
When Cab required is checked
When the 'Cab Required' checkbox is unchecked
If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.
By doing so you help other community members find resolved questions which may relate to an issue they're having
Thanks,
Astik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 12:37 AM - edited 04-19-2024 12:41 AM
Hi @JaganN971616731 ,
You need to understand difference between setDisplay() and setVisible() . both are used to hide fields on form but there is difference which is explained in below points -
setDisplay()
If the field is hidden, the space is used to display other items. that means below field like, if sub status of the incident is not displaying then assignment group will display on that blank space.
setVisible()
If the field is hidden, the space is left blank. You can see the change on the form clearly.
Please make changes to your code as below
function onCondition() {
g_form.setDisplay('cab_date_time', false);
g_form.setDisplay('cab_recommendation', false);
}
If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.
By doing so you help other community members find resolved questions which may relate to an issue they're having
Thanks,
Astik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 01:07 AM
When I create a new CR initially the fields are visible on the UI. After making the Boolean true and then false the fields are not visible(working as expected). My requirement is that when you create a new CR the fields should not be visible on the UI. Over make the Boolean true it should be visible.
After make it true and then false:
Regards,
Jagan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 01:30 AM
Hi @JaganN971616731 ,
In UI policy, there are two scripts: one that executes if a condition is met, and a second one that executes when the condition is not met. In the "Execute If False" script, you would write the opposite logic of the "Execute If True" script. Please check below example
Execute if true Script -
function onCondition() {
g_form.setDisplay('u_cab_date_time', true);
}
Execute if false Script -
function onCondition() {
g_form.setDisplay('u_cab_date_time', false);
}
When Form is Loaded
When Cab required is checked
When the 'Cab Required' checkbox is unchecked
If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.
By doing so you help other community members find resolved questions which may relate to an issue they're having
Thanks,
Astik