Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Email Notification - Send to is from Cat.Item Variable

Clayton Parker
Tera Contributor

I have a catalog item where it pulls the organization manager, and then someone inputs a reporting manager. Whenever this catalog item is submitted, I would like the email notification to go to the Organizational Manager and Reporting manager based off of the variable when it's submitted. How can I acheive this?

3 REPLIES 3

GlideFather
Tera Patron

Hi @Clayton Parker 

create a flow triggered when this particular catalog item is submitted and add action “send email” where you can configure the content, recipient etc

_____
This reply is 100 % GlideFather and 0 % AI

Helio Gabrenha1
Tera Contributor

You can create a specific Notification for that catalog item, and add a email script to it.

You can find documentation on how to create and add emails scripts here: LINK 

 

On your mail script, there's an Email object where you can add the reporting Manager as a CC'ed recipient.

The script:

// Retrieve the sys_user ID from your manager variable field
var managerID = current.variables.your_variable_manager_field;
// check if there's something
if (managerID) {
     // Load the corresponding User record
     var grUsr = new GlideRecord("sys_user");
     grUsr.get(managerID);
    // Attach that user's email address and display name as additional recipients of notification
     email.addAddress("cc", grUsr.email, grUsr.name);
}

 

Rafael Batistot
Kilo Patron


Hi @Clayton Parker 

 

you can create a business rule: after > create

condition: item > <name_of_catalog>


In the script you call the event for the notification: 

gs.eventQueue('my.custom.notification.event', current, gs.getUserID(), '');

 

 

steps 


Create the Event

  • Go to System Policy → Events → Registry.
  • Click New and fill in:
    • Name: something like my.custom.notification.event
    • Table: sc_req_item (if it’s triggered from a Request Item)
    • Description: brief purpose of the event.
  • Save.

 

Create the Notification

  • Go to System Notification → Email → Notifications.
  • Click New and set:
    • Name: same idea, e.g., “Notify on Catalog Item Creation”.
    • Table: same table as event (sc_req_item).
    • When to send: choose Event is fired and select the event you created.
    • Recipients: define who will get the email (could be users, groups, or script).
    • What it will contain: write subject and body (use variables if needed).
  • Save.

 

 

 

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.