On-change Client script in Loop in Servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2023 12:44 AM - edited 08-11-2023 12:50 AM
Hi All,
I wrote one client script on change based on the if condition status could not be change & its will through info/error message & status will back to "in progress" state instead of changing any status.
Info/Error message not showing & alert is showing as a loop

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2023 12:51 AM
Hello @abirakundu23
Try modifying below line
if (tickettype == "871c5d5e87b3e9140811646e8bbb3530" && approv == "not requested")
to
if (tickettype == "871c5d5e87b3e9140811646e8bbb3530" && approv == "not requested" && oldValue != newValue)
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2023 01:03 AM - edited 08-11-2023 01:18 AM
Hi @Ahmmed Ali ,
Its not working after adding the condition. Its working same like going on loop.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2023 01:29 AM
Hello @abirakundu23
One simple solution which does not require any code would be to have an UI policy created with your condition and make the state field read-only.
You can also add the field message for the state field saying state cannot be changed.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2023 02:10 AM
Hi @Ahmmed Ali ,
Actually we made read only on status but assigned to not able to change any status that should be a blocker.