Ui actions to send an email

nehas
Kilo Contributor

Hello community,

I have an requirement in which i have to create an button using ui actions which is visible only when an particular sub-category is selected and on clicking the button an email should be sent to the client.

Please provide me with some suggestions to solve by requirement

18 REPLIES 18

Nireesha2
ServiceNow Employee
ServiceNow Employee

1. Create a UI action


Condition: sub_category=="value"


Script:


gs.eventQueue("button.clicked", current, gs.getUserID(), gs.getUserName());





2. You need to define the event in system definition > event registry


Click on the below link for more details on how to register an event.


Register an event




3. Create an email notification. Go to the tab "When to send", change the value of field "send when" to "event is fired".


Select the event name "button.clicked"


Now define your users, groups , subject and email body.


Screen Shot 2018-01-18 at 2.35.58 PM.png


nehas
Kilo Contributor

I have done the above steps even though the email is not sent


Nireesha2
ServiceNow Employee
ServiceNow Employee

Can you show your UI action script and may I know on what table you created the notification?


nehas
Kilo Contributor

i created an event in system policy> events>registry like this



find_real_file.png



Is my way of creating the event   and i donnot understand will the event get fired when the button is clicked?