On-change Client script issue in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 11:02 PM
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.
But for when we select "Resolved" , inside the if loop is not executed & alert message not executed.
Regarding this request instead of adding this condition : if (tickettype == "871c5d5e87b3e9140811646e8bbb3530" && approv == "not requested" && g_form.getValue("state") != "In progress") to if (tickettype == "871c5d5e87b3e9140811646e8bbb3530" && approv == "not requested" && g_form.getValue("state") == "Resolved") not working properly after if loop, within if loop alert not display. could you please help me on that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 11:53 PM
Hi @Vicky Kumar Sh1 , I have changed but it is not working from if condition. No alert() message is not executing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:07 AM
Try alerting all the value first. And one more issue I can see is that you are checking getValue('state')=='Resolved')
Check with backend value of resolved. It is 6. getValue('state')=='6' or getValue('state')==6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:08 AM
Add a line containing debugger; in front of line var tickettype = g_form.getValue('type');
Use developer tools in your browser to check if all values contain what you expect.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.