Async business rule sometime working and sometimes not

Debasis Pati1
Tera Contributor

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.

DebasisPati1_0-1665732588233.png

DebasisPati1_1-1665732614304.png

 

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

 

 

 

9 REPLIES 9

Hi,

check this

if Flow Designer support for the Service Catalog plugin (com.glideapp.servicecatalog.flow_designer) plugin is activated then it should show

Flow designer does not trigger on Request Item [sc_req_item] and Catalog Task [sc_task] 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

I see this plugin is already activated but in table field I don't see sc_req_item table is present.

DebasisPati1_0-1665741403410.png

DebasisPati1_1-1665741446425.png

 

Regards,

Debasis

 

are you in scoped app? if global scope then it should show

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar I am in global scope sc_request table is showing but sc_req_item is not showing can it be directly done on request table itself?

 

Regards,

Debasis

it can be done

You need to use Lookup Record on RITM table to find the RITM and then get the item name

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader