Issue with Async Business Rule

RiteshSwarnakar
Giga Guru
Hi ServiceNow Experts,
 
I just want to understand why the below script is not working in Async Business Rule:
 

 

var gb = new GlideRecord('cmdb_ci');
    gb.addEncodedQuery('correlation_id=test');
    gb.query();
    if (gb.next()) {
        gs.log('yes', 'BR_test');
    }

 

 
Note:
I have created this business rule on custom import set table.
I have tested this using After BR and it is working fine as expected.
The requirement is to run with Async Business Rule only
 
 Can someone please let me know what is the issue here?
 
8 REPLIES 8

Maik Skoddow
Tera Patron
Tera Patron

Hi @RiteshSwarnakar 

Please explain the use case and what exactly is not working

Thanks, Maik

Hi @Maik Skoddow,

 

My use case is to check if CI with given correlation_id exists in CMDB, if it does then create relationship/record in cmdb_rel_ci table.

 

As it is taking much time to query and find the CI using After BR, so I want it to make as Async BR.

Hi @RiteshSwarnakar 

okay, got it. But what exactly is the issue? You only write that something does not work, but what? What is your expectation and what is the observed result?

Maik

Hi @Maik Skoddow ,

 

Why the simple code is not returning result, even I tried multiple ways, The same is working in After but why not in Async.