Fix script to call Retrieve Completed Update Set UI action for a particular Remote Instance

mansing
Giga Contributor

I have setup a remote instance in update source (in order to get update set from dev instance) now I am trying to automate retrieve completed update set functionality which is basically an UI action. Is there any way to call this UI action i.e. Retrieve Completed Update Sets from that particular Remote Instance record.

Thank you.

1 ACCEPTED SOLUTION

mansing
Giga Contributor

I have the following script prepared to retrieve completed update set from a particular Remote Instance. This serves my purpose.



var id, gr   = new GlideRecord('sys_update_set_source');


  1. gr.addQuery('name','game');
  2. gr.query();

if(gr.next()){


id= gr.getUniqueValue();


}


var worker = new GlideUpdateSetWorker();


var sys_id = id;


  1. worker.setUpdateSourceSysId(sys_id);
  2. worker.setBackground(true);
  3. worker.start();

var progress_id = worker.getProgressID();


  1. gs.print(progress_id);

View solution in original post

3 REPLIES 3

Dave Smith1
ServiceNow Employee
ServiceNow Employee

Yes - clicking a UI Action simply performs a HTTP GET action, so the URL text beneath that link ought to be a clue.


Dave, Thank you for the reply.



The URL does not get changed when clicked on UI action from within a particular record of Remote Instance. How do I get that URL text?



Basically I am trying to execute UI action 'Retrieve Complete Update sets' in ecsd context from a fix script so it can take the values of URL, username and password by its own during execution.



Any help?



find_real_file.png


mansing
Giga Contributor

I have the following script prepared to retrieve completed update set from a particular Remote Instance. This serves my purpose.



var id, gr   = new GlideRecord('sys_update_set_source');


  1. gr.addQuery('name','game');
  2. gr.query();

if(gr.next()){


id= gr.getUniqueValue();


}


var worker = new GlideUpdateSetWorker();


var sys_id = id;


  1. worker.setUpdateSourceSysId(sys_id);
  2. worker.setBackground(true);
  3. worker.start();

var progress_id = worker.getProgressID();


  1. gs.print(progress_id);