How can I use async methods for attachments?

ISAI23
Tera Contributor

Hello friends, I working on one performance issue for one business rule I didn't code. I see that the developer is calling one RestMessage API that retrieves a file, in the code they put something like this:

 

var rm = new sn_ws.RESTMessageV2("record", "method");

rm.setStringParameterNoEscape(id);

rm.saveResponseBodyAsAttachment("customTable", current.sys_id, "example.pdf")

rm.executeAsync();

rm.waitForResponse(10);

 

As you can see, they're saving the atachment directly with 'saveResponseBodyAsAttachment' method and this works but we have been reported this is causing performance issues How can I change it without impacting the principal functionality. I was thinking to use setEccTopic and handle the attachment response there by creating another business rule but I'm not sure how to achieve it either.

0 REPLIES 0