Email notification via workflow

clyon
Tera Guru

I have a workflow that runs on the cmdb_ci_appl table that creates an INC. I need an email notification to be sent when the INC is created (assigned to group  or Assigned to me).  

I found that workflows created incidents don't trigger condition based email notifications.  That correct?

So I created 2 events and duplicated the current email notifications (Incident assigned to group & Incident assigned to me) and set them up to be fired by the event with an additional condition of assignment_group = Review.  

I ran my workflow and the events were created but what I realized was that the workflow is running on cmdb_ci_appl and that automatically creates the event on that table, where as I need it created on the Incident table.

What are my options to have an email notificaiton sent out when the workflow creates the Incidents?

1 ACCEPTED SOLUTION

Mwatkins
ServiceNow Employee
ServiceNow Employee

Ah ha! Thanks for that screen shot Christina. The incident is being inserted with setWorkflow(false) - line 32 of the Workflow Activity in your screenshot. That is going to cause the platform to bypass the notification engine. There are a couple options:


1) Don't use setWorkflow(false)


2) Switch your notification over to one that fires on event creation. Use a Business Rule after insert/update to trigger the event.


(see Create your own event and Create an email notification for details about how to do this)


View solution in original post

12 REPLIES 12

vab_13
ServiceNow Employee
ServiceNow Employee

I wonder why can't you leverage the notification workflow Activity, have a read:



https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/administer/workflow-activities/...




Mark your feedback( Like or Helpful or Correct) as per the impact of my response. Cheers!


Vab


Nate23
Mega Guru

condition based notification should still apply to scripted inserts into a table. Carefully analyze your conditions and when they apply.



does you condition apply on "insert" , "update" or both? also does the record you are creating meet all the conditions ie: [field] [is/changes to] [value]. also are you applying setWorkflow(false) on your gliderecord insert?


also, to address your event issue. if your event and notification are registered on the incident table and you are using the event workflow activity it will run it based on the table that the workflow is applied. I would fire the event in your wf script that creates incident using:


gs.eventQueue('event_name', yourIncidentGliderecord, parm1, parm2);


I was able to change the conditions and get one of the types of emails to send. Still working on why the other won't send.



Thanks for the info. Really appreciate it!