How to identify the exact UI action on the form when there are multiple with same name

k_jayanth
Tera Contributor

I have a requirement where i need to execute the Risk calculator as soon as the Risk assessment form is submitted. So i have decided to run the 'Execute risk calculator' UI action when the risk assessment form is submitted. I need to add my code on the 'submit' button of Risk assessment form but there are more than 200 UI actions with same name. So i need a way to identify the action name of this submit button.

Many Thanks

- Jayanth

8 REPLIES 8

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Jayanth,



You can use getActionName at client side to determine action name of UI action.




function onSubmit() {  


    var action = g_form.getActionName();  


    alert('You pressed ' + action);  


}  




Thanks for the reply Pradeep,



The onSubmit function was not getting triggered as i was submitting the risk assessment form, hence i was unable to use this function. The change request form reloads when the Risk assessment form is submitted.


shruti_tyagi
ServiceNow Employee
ServiceNow Employee

Or you can also find it out using developer tools its easy.



If you are on Chrome follow these steps:



To open Developer tool:


Right click on the form and hit inspect or On the browser More tools Developer tools:



Screen Shot 2017-09-14 at 10.12.22 PM.pngScreen Shot 2017-09-14 at 10.17.30 PM.png



Once dev tool is open go to Elements tab, select element on the page to inspect (little arrow at the left). It will give all details of button you want to inspect. Something like this:


<button class="form_action_button header   action_context btn btn-default" style="white-space: nowrap" type="submit" value="sysverb_update" onclick="return gsftSubmit(this);" id="sysverb_update" data-action-name="sysverb_update" gsft_id="42df02e20a0a0b340080e61b551f2909" name="not_important">Update</button>



gsft_id="42df02e20a0a0b340080e61b551f2909" is sys_id of UI action:


Screen Shot 2017-09-14 at 10.22.01 PM.png



You can search for UI action using this sys_id:


Screen Shot 2017-09-14 at 10.24.07 PM.png



Thanks


Shruti


If the reply was informational, please like, mark as helpful or mark as correct!


Thanks for the Reply Shruti,



I tired using the developer browser tools but i was unable to find the sys_id, please find the screenshots below.



find_real_file.png