UI Macro call a UI Action

poyntzj
Kilo Sage

Hi all

Is it possible from a UI Macro to call a Ui Action ?

There is some code on the instance here which does a few bits and loads from a UI Page and works well

However, I may want to call this routine from elsewhere (on the CMS) and that it is all Ui Macro driven

My initial attempts are not working and I am not sure if it is possible, a code issue or the click not being registered

Cheers

1 ACCEPTED SOLUTION

Manjul Katare
ServiceNow Employee
ServiceNow Employee

An interesting one to try out.


I created a UI action on incident table and then invoke it through UI Macro by bringing it in the Incident form as UI formatter.



UI Action:


find_real_file.png


UI Macro:


find_real_file.png


UI Formatter:


find_real_file.png



Now as a result of it, When I open any incident form it opens "www.servicenow.com" on a new page. Basically UI Macro is calling a UI action.



Hope this help!


-Manjul


View solution in original post

6 REPLIES 6

Manjul Katare
ServiceNow Employee
ServiceNow Employee

An interesting one to try out.


I created a UI action on incident table and then invoke it through UI Macro by bringing it in the Incident form as UI formatter.



UI Action:


find_real_file.png


UI Macro:


find_real_file.png


UI Formatter:


find_real_file.png



Now as a result of it, When I open any incident form it opens "www.servicenow.com" on a new page. Basically UI Macro is calling a UI action.



Hope this help!


-Manjul


This will surely work, but it will violate technical best practice as it uses document.getElementById.



If the code in the UI Action is pure server side you could to a gsftSubmit with the action name as parameter. Unfortunately there is not a lot of documentation around this method though.


Doh!


I wrote this in a hurry yesterday before my household got busy for a birthday party and when I looked at my emails later and saw the reply, I realised I had posted the wrong quetion !


However, your answer is correct for calling a UI action


I need to call a UI Script - so a new question about to be posted


iam getting error