Issue with Async Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 09:25 AM
var gb = new GlideRecord('cmdb_ci');
gb.addEncodedQuery('correlation_id=test');
gb.query();
if (gb.next()) {
gs.log('yes', 'BR_test');
}
- Labels:
-
vancouver release
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 09:55 PM
first, please replace your log statement with
gs.info('BR_test');
as your version is deprecated and shouldn't be used any longer.
Then one thing to consider: A "after" Business Rules runs as the authenticated user in it's session context. However, an "async" Business Rule runs as the "system" user in the background and thus decoupled from the current user's session. And there is also no guarantee when that async Business Rule is running. ServiceNow creates a scheduled job for each execution of an "async" Business Rule. So maybe you have not waited long enough to see the output in the syslog table.
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 04:17 PM - edited 01-06-2024 04:19 PM
Async BR's will run on its own based on the system performance at that particular time. This means your log statement may not appear immediately after you execute the import set procedure.
If this BR is in a scoped app, use gs.info instead of gs.log.
Try to increase the priority to 900 and see.
But I am not really sure what would you like to accomplish here
Thanks,
Narsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 08:33 PM
Thanks @Narsing1 , for your inputs. I tried your suggestions but still same issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 08:43 PM
Ok. Would like to know the complete code of your BR. from the given script, you are always checking the correlation id as "test". Also, a sample record of your custom importset table.
Thanks,
Narsing