To make Additional Comments Mandatory and visible on condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 07:50 AM
Hi all,
I want to do these two things when onHold Checkbox is checked on sc_task form:
1) Make Additional comments as visible and mandatory
2) Shows the "Additional Comments" as long as the checkbox "on Hold" is checked, (non mandatory after first change).
So I am defining this Busines rule on SCTask table,
When: before
insert and Update
Condition: onHold is True.
I have created one flag variable to check if the onHold is checked for the first time. which check_on_hold_first_time
This is my code, but except making check on hold first time as true it is not performing any action.
Please help.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 08:10 AM
Hello @pandeyved,
First of all, the requirement you are trying to achieve doesn't need scripting
And secondly Business rules are server side and the requirement you are trying to achieve is client side.
Try to achieve it using UI Policy which is a lighter version of Client Script.
ServiceNow UI Policy is a feature that allows you to dynamically change the behavior of form fields based on certain conditions. You can use UI Policy to show or hide fields, make fields mandatory or read-only, or set default values for fields.
To achieve your requirement of making Additional Comments visible and mandatory when onHold checkbox is checked on sc_task form, you can use a UI Policy to run a script that checks the onHold field and sets the comments field accordingly. However, unlike a business rule, a UI Policy only affects the client-side and does not update the database.
To create a UI Policy for making Additional Comments visible and mandatory when onHold checkbox is checked, you can follow these steps:
- Navigate to System UI > UI Policies and click New.
- In the Name field, enter a name for the UI Policy, such as “Show Comments when onHold”.
- In the Table field, select “Catalog Task [sc_task]” from the drop-down list.
- In the Global field, check the box next to “Global”. This will make the UI Policy apply to all tables that extend from the task table, such as sc_task.
- In the Reverse if false field, check the box next to “Reverse if false”. This will make the UI Policy reverse its actions when the condition is false.
- In the Condition field, enter “onHold is true”. This will make the UI Policy run when the onHold field is checked.
- In the UI Policy Actions related list, click New.
- In the Name field, enter a name for the UI Policy Action, such as “Make Comments Visible and Mandatory”.
- In the Field name field, select “Additional comments [comments]” from the drop-down list.
- In the Mandatory field, select “true” from the drop-down list.
- In the Visible field, select “true” from the drop-down list.
- Click Submit to save the UI Policy Action.
- Click Submit again to save the UI Policy.
Hope this helps
Kind Regards,
Swarnadeep Nandy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 08:21 AM
Thanks for your help.
But in my case scenario is different, if checkbox clicked first time then only Additional comments needs to be updated on RITM, not in sc_task. That is why I have created a flag variable also. Please help ne in this context.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 08:27 AM
See, for making it mandatory and Visible you have to use Client side scripting anyway (PERIOD).
Now coming to your point if the checkbox is clicked for the first time or not and you are maintaining it in another field, then I would suggest use scratchpad or Ajax to get the value of that flag variable on the client script/UI policy and then run your script accordingly.
Regards,
Swarnadeep Nandy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 08:31 AM
@SwarnadeepNandy
can you please help me in achieving this using my above code please.
its a priority requirement
Thanks