
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 09:41 AM
I have the following requirement for the incident form: If the state changes to on hold, or the priority is escalated (changes to numeric value less than previous value), comments should be mandatory.
Sounds simple, but no luck in practice. My thought was to run two different client scripts, one on change of state and the other on change of priority. The problem is, in my client script on change of state I have no way to check if the priority was escalated or not. If the state changes from on hold back to something else I would want to make comments not mandatory, only if there is not a priority escalation.
Is there a way I could pass a flag from one client script to the other?
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 09:50 AM
You can achieve these requirements using business rule.
You can check if priority or state is changed, and then implement your validation in business rule.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 11:30 AM
I thought about g_scratchpad, but what happens of multiple users are in the system at the same time, with multiple incident forms? My understanding is they would all share the same g_scratchpad variable, so when an onChange client script is triggered, there's no guarantee the g_scratchpad variable would still reflect the current record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 11:36 AM
I think scratchpad value is session specific. It wont store a value from another user session
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2019 09:48 AM
Thanks, I think that is correct although I cannot find any documentation to confirm it. All the documentation talks about using g_scratchpad to pass data from server to client rather than client to client. This may very well work but I decided it was simpler to just validate with a business rule.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 09:08 PM
- Make a Client Script that increments Priority by one when Status change to on hold. Decrement priority back to normal using oldValue variable if Status changes back off onHold.
- Write a UI Policy that enforces the population of work notes when priority changes.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022