What is the 'action' object in the UI action?

Ravish Shetty
Tera Guru

var ppa = new GlidePreviewProblemAction(action, current);

ppa.ignoreProblem();

I saw this out of the box code in the the 'Accept remote update' UI action.

I want to execute this script in the background script.

For that i want to know what this 'action' object referring to or what can i use in its place?

4 REPLIES 4

tltoulson
Kilo Sage

Hi Ravio,



The action variable is a special variable in UI Action scripts.   It allows you to perform redirects as in this wiki article: Creating a UI Routing Action - ServiceNow Wiki.



It is of the class GlideAction but this class (formerly packages.com.glide.script.Action) is not documented so there is no telling how or if you may be able to use it.


David Vu1
Kilo Expert

I face with the same problem,
Community, Please help!!!



Thanks,


Dan_Berglin
Giga Expert

Hi Ravio,


You can put gs.action as the action parameter.



An example usable by us who are lazy :


var gr = new GlideRecord("sys_update_preview_problem");


          gr.addEncodedQuery("remote_update_set=5a3b8a5c0fcf32005e9a1b2be1050ed5^status=^description=Found a local update that is newer than this one");


          gr.addQuery("status","");


          gr.query();



while(gr.next()) {


  var ppa = new GlidePreviewProblemAction(gs.action, gr);


  ppa.skipUpdate();


}



Outputs:


Background message, type:info, message: Problem has been skipped. The update that caused this problem will not be committed.


It worked like a charm for me. Thanks!!!