on submit client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
Hi All,
if some tries to resolve (using an Ui action) the problem record and if there are open problem task records, I want to restrict that and keep the state in fix in progress state only.
I am trying this using on submit client script and not business rule because when I try to resolve it state will temporarily move to resolve state but when I refresh it, it will move back to fix in progress. and I don't want that. nor did the client.
so here is the script below -
client script - on submit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
I tried using before update br but as I mentioned it gave me the issue where when State was changed to Resolved and then after reloading it was moved back to In Progress on problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @tushar_ghadage ,
Please check if any script causing this issue with lower order on problem table. Try to deactivate your script and run still facing this same issue
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @tushar_ghadage
onSubmit() Client script won't work in this case. You have to use "before update BR".
(function executeRule(current, previous /*null when async*/) {
if (current.state == "106") {
var gr = new GlideRecord('problem_task');
gr.addEncodedQuery('problem=' + current.sys_id + '^active=true');
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage('There are active problem task.');
current.setAbortAction(true);
}
}
})(current, previous);
Additionally, change the order of BR, so that your BR executes first.
Thanks and regards,
HN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I tried that
as shown in your screen shot state will move to resolve and then after reloading the state will move back to fix in progress that's what I don't want . ( similar is happening with me also )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
why not hide that Resolve button if any active problem task is there?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
