Async business rule sometime working and sometimes not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2022 12:31 AM
Hi, I have a simple requirement we need to copy the name of the catalog to req short description we cant change all the flow to get this done so i have created an async business rule on the req item table but its sometimes working and sometimes doesn't.
Above business rule script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.log("frombrscript");
var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request);
req.query();
if (req.next()) {
req.short_description = current.getDisplayValue('cat_item');
req.update();
}
})(current, previous);
@Ankur Bawiskar Can you please suggest why this doesnt work everytime it works sometimes only.
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2022 12:36 AM
I see the code is fine.
Not sure why it's failing sometimes?
You need to debug in which case it's failing and what's the root cause
Did you try to use flow designer for this as a workaround?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2022 01:01 AM
Hi @Ankur Bawiskar we have around more than 100+ flows and for every flow we cant change and get this done that's why I wrote this business rule i am doubting on the order and priority things .
Can you suggest i did debug but cant find out why there is no such conditions also for which this business rule shouldn't run sometime .
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2022 02:08 AM
you can create only 1 flow which triggers on insert of RITM and it will update the REQ.
let other flows be there no impact with the one you create.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2022 02:27 AM
Hi Ankur,
I tried to create one flow on Ritm table on insert but unable to find ritm table there