is it possible to call a processor from a background script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2018 10:47 AM
is it possible to call a processor from a background script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2018 04:05 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2018 09:34 AM
Hi @Jon, thank you for your reply. I upvoted this question yesterday as I am also interested in this question.
In my case, I want to programatically call the URL to the processor, within a loop where I fill in sysparm variables programmatically.
I have implemented the SNGuru solution to capturing all attachments on a task as a ZIP file which introduces a processor called "exportAttachmentsToZip". It is designed to be called via a UI Action which does an action.setRedirectURL() call with sysparms in the URL.
I would like to programmatically call this functionality by generating my own URLs, in something like the following (in a background script or a scheduled job script):
var gr = new GlideRecord('incident');
gr.addEncodedQuery('sys_created_on>=' + gs.beginningOfThisYear());
gr.query();
while (gr.next()) {
var URL = 'exportAttachmentsToZip.do?sysparm_sys_id=' + gr.sys_id + '&sysparm_table=incident';
gs.print('URL = ' + URL);
// call exportAttachmentsToZip.do processor with URL variable from above, here
}
I don't think it is possible to do within a script, but wanted to confirm.
Thanks for any thoughts you can provide!
Julie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 06:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 01:17 PM
Thanks for your reply, Jon. In answer to your question, don't care about what the call returns. I had a quick look and I figure this would be a Scripted REST API if it was possible at all, plus I'd have to translate my output (which should be a .zip file) from the encoded format back to .zip. Complicated.
In the end I decided to use "Macro Express" (a cool little piece of software!) to automate the copy & paste of the URL generated from my script, from notepad, to a browser window. Works like a charm!
Thanks for your replies and attempts to help!