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
3 hours ago
Hi @tushar_ghadage,
have you heard of State flows?
You can create a state flow on problem table and apply the conditions to restrict the state change if child records are still open.
If you encountered the situation when State was changed to Resolved and then after reload it was moved back to In Progress, it seems that your BR was after (the code happened after the update was written to the database), perhaps if you re-test it again with before BR that could do the trick...
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
actually, it was before update Br and also, I tried with changing the ordering of Br but did not seem to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @tushar_ghadage ,
I don't think you can use GlideAjax on OnSubmit Client script, because it will cause issue when sending back the data to client script
Instead of that you can use Before BR on problem table
var gr = new GlideRecord('problem_task');
gr.addQuery('problem', current.sys_id);
gr.addActiveQuery();
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage('Cannot resolve Problem. There are active Problem Tasks that must be closed first.');
current.setAbortAction(true);
}
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
Result
When trying to close problem but having open problem task
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
