Complete Tutorial of UI Action in ServiceNow with Examples

Article briefs about UI Action in ServiceNow in detail. Practical demonstration of Server Side and Client Side UI action examples has been given through video demonstration along with theoretical understanding. Practical example of Server side scripting and client side scripting in servicenow has been demonstrated through videos attached in this article.


ui action in servicenow,ui actions in servicenow,servicenow ui action server side

Below is the topic which is covered in the ServiceNow tutorial:

  • ServiceNow UI Action
  • Client side and Server Side scripting practical implementation video.
  • ServiceNow UI Action Interview question asked by interviewer.

What is UI Action in ServiceNow?

UI actions are basically a UI element that can be show up in the form and when these UI elements get clicked then script (Java script code) get executed, this script is written in UI action script section. 
UI Actions in ServiceNow is basically used to make UI more interactive and customizable. UI elements which can be shown in form are form button, form context menu, form link, list banner button, list context menu, list choice and list link etc.

UI actions in servicenow can run on server side and client side both, Mostly requirement is of to run UI action on server side. You can add UI actions to tables and database views that are in the same scope.
Users who have admin or ui_action_admin role can define servicenow ui action.

To get information on servicenow roles, you can refer below link:
ServiceNow Roles

Below are the steps to create ServiceNow UI action:

  • Login as administrator
  • Navigate to System Definition – Click on UI Actions option
  • Click on New Button

Below is the Image of ServiceNow UI actions form:


ui action in servicenow,servicenow ui action,servicenow ui action server side

To know about Client Side Programming and Server Side Programming in ServiceNow, you can refer below links:
Client Side Programming in ServiceNow
Server Side Programming in ServiceNow
Below is the use case to understand the what kind of requirement can be catered through UI Actions in ServiceNow:

Use Case: Let’s say you have to implement a new button in incident form. Let’s say button name is “Assigned to Me” and the functionality is that when you click on assigned to button then then logged in user name should get populated in “Assigned To” text box available in incident form. 
But the catch is that first the system should validate that the logged in user should be the member of Assignment group which is defined in “Assignment group” field and then the name get populated in Assigned to field otherwise system should display pop up to user with message that “Logged in User is not from the assignment group”.

So, the case which is mentioned above, developer will write the code which has to executed server side and client side both.  

Some more simple use cases are mentioned below, you can do hands on below use cases to understand the UI action.

Use Case: Form validation on the click of button.
Use Case: Navigate to another page on the click of form link available in form based on user role and authorization.
Developer can only write server side script or only client side script in ServiceNow UI Action. Basically, it totally depends on the requirement given to implement.


Scripting example of Server Side UI Action in ServiceNow:

Below video will demonstrate server side ui action implementation in servicenow.



Scripting example of Server Side and Client Side UI Action in ServiceNow:

Below video will demonstrate server side and client side ui action implementation in servicenow.




Below are the ServiceNow UI Actions interview questions which is asked by Interviewer:

Please find the questions below:

Question: Where can we use ServiceNow UI action client side or server side?
Answer: We can use UI action client side and server side both. It totally depends on requirement that what we have to implement.

Question: Tell me the syntax how can we write client side and server side in ServiceNow UI action?
Answer: Above video tutorial will provide you the answer.

Question: How can we redirect a user to the appropriate page after the ServiceNow UI Action executes?
Answer: action.setRedirectURL('Mention URL') method

Question: How can we make sure that user remains on the current page after clicking on UI action element?
Answer: action.setRedirectURL(current) method

I hope above ServiceNow tutorial helps you to understand the ui action in serviceNow. More servicenow tutorials and servicenow tutorial videos  are available in this website. For ServiceNow learning you can refer those. Thankyou, Good Luck.

No comments:

Thankyou !!!!

Powered by Blogger.