The CreatorCon Call for Content is officially open! Get started here.

Custom subflow to Fire Event

Gary Fawcett1
Tera Guru

Hi,

Trying to create a subflow that accepts a group name, Event Name and Record.

The Event Name input is a string.

But the "Fire Event" reports Event name is blank or similar.

If you hard code the event name it works fine.  But that makes a subflow kind of pointless.

 

I have seen articles say you need to make the input a reference filed to the "sysevent_register" table.  But this isn't an option for me?  (This is a scoped application).


Has anyone made this work?


Thanks...Gary

GaryFawcett1_0-1757907306236.png

 

11 REPLIES 11

Yes, hopfully I can make the Event Name Dynamic.  So I can make the subflow reusuable within other flows.

 

The flow created an event for every member of a group. The event then sends a notification.  These groups don't have group emails.

See attached screen shot of the Fire Event, this is currently hard coded to an event.

Thanks...Gary

GaryFawcett1_0-1757963626270.png

 

@Gary Fawcett1 

you can pass event name and then in Action query event table and get the GlideRecord object.

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

Pranesh072
Mega Sage

You are using wrong approach to use the group member table in event. Ideally it should be the record for which you triggered the notification. Like Incident, tasks etc. 

 

If you want to send the notification to group members you can use the Include members checkbox available on the group record.

 

 

https://www.servicenow.com/docs/bundle/zurich-platform-administration/page/administer/users-and-grou...

Yes that is true, but the customer only wants to send to the group when a data condition is met.  But yes that would work if I created multiple notifications.

Gary Fawcett1
Tera Guru

Thanks everyone, I decided in the end to create a Script Action to respond to an event.

This works for what the customer wants to do.  So I send an event from the flow and the script action sents the event.  Which in turn sends the email. 

var groupName = event.parm1;
var eventName = event.parm2;
var getUsers = new GlideRecord('sys_user_grmember');
getUsers.addEncodedQuery('user.active=true^group.name=' + groupName);
getUsers.query(); //Execute the query
while (getUsers.next()) {
    try {
        gs.eventQueue(eventName, current, getUsers.user.email, getUsers.user.first_name);
    } catch (ex) {
        gs.info("ERROR: " + ex.message);
    }
}