What are ActionUtils?

Not applicable

What exactly do the following lines of code do? I've seen them in a number of places and in particular in an the UI Action for Update buttons.


var au = new ActionUtils();
au.postInsert(current);
4 REPLIES 4

Mark Stanger
Giga Sage

Have you looked at 'System Definition', 'Script Includes'?. ActionUtils comes from there. It's a set of utility functions for UI actions.


jeremyeperdue
Giga Expert

To add to Mark's point, it is a library in a Script Include.   They are various utility functions to assist the execution of action scripts.


They assume the existence of an "action" global variable pointing to an instance of Action.java


In your example. Current is being passed in to use the sys_id of the current form.



gs.include('ActionUtils');


var au = new ActionUtils();


au.<doSomething>"






There is more code than this, but this is what is being called in your example.


au action utils.PNG


Hi,



When we are trying to override submit ui action in scoped application, it is unable to find action variable.



It is giving below error.


org.mozilla.javascript.EcmaError: "action" is not defined.


Caused by error in Script Include: 'ActionUtils' at line 14



11: if (gr.isActionAborted())


12: return;


13:


==> 14: var linkedM2MTable = action.get('sysparm_link_collection');


15: if (linkedM2MTable)


16: this._insertM2M(linkedM2MTable, gr.sys_id);



Please help me on this


have you found solution for this problem?