Email notification from Workspace declarative action

SaranGv
Giga Contributor

Hi All,

 

I have created declarative action in workspace from here we need to change the state of incident and send an email to opened_by and their manager from workspace declarative form action.

Once the user clicked on form action button a modal will pop up and once they click on confirm button in modal, incident state should be change and email needs to send.

 

Could anyone help with the process or steps. Thanks

4 REPLIES 4

priyanka1028
Tera Contributor

For the email notification, follow the steps below:

  1. Create an event in the Event Registry table .

  2. Create a notification with the following details:

    When to Send:

    • Table: incident

    • Send When: Event is fired

    Who Will Receive:

    • Check the "Event parm 1 contains recipient" checkbox.

    • Check the "Event parm 2 contains recipient" checkbox.

    What It Will Contain:

    • Add the content you want to include in your email notification.

  3. In the Declarative Action's server script, you can update the state of the incident using the current object as shown below:

     
    current.state = 'new_state';
    current.update();
    gs.eventQueue("event_name", current, opened_by, manager);
     
    If my answer has helped with your question, please mark my answer as accepted solution .
    Thank You
     

Hi Priyanka, 

 

Thanks for the response.

Small correction in my query - in declarative action a modal will popup in that there is cancellation reason text box and another CONFIRM button once that is clicked then mail need to be sent along with cancellation reason that is being stored in a field in incident table. In declarative action i selected UFX client action in implemented as ( Not server script or client script).

Hi @SaranGv , 

 

Please follow the above-mentioned steps 1 and 2 as they are. Then, use GlideAjax to call the Script Include, and make sure to fire the event within the Script Include

 

Thank you

Ankur Bawiskar
Tera Patron
Tera Patron

@SaranGv 

You can use onChange client script and use g_modal API and then use GlideAjax to send the email via gs.eventQueue() in script include function

what did you start with?

UI Actions in Workspaces 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader