How to get values from a event parameters and use them in a notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 06:41 AM
I'm trying to setup a notification for when a certain catalogue item is completed. The catalogue item contains a list of business application that a user chooses to update. I've created a business rule that triggers the event:
I'm trying to use the following code to find any business applications that had been updated at the same time:
However, what I find is that nothing is being returned in the logs even though a business application has been updated through the catalogue item.
My email notification is using the Business Application table:
What I'm finding is that the ${u_business_owner} and ${department} fields are not getting updated:
If somebody can advise what I need to do to retrieve the values, that would be great.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 03:51 AM
changes here
1) line 6 should be busApp.next()
Notification, BR should be on same table
Since your BR and notification is on RITM (sc_req_item) table you won't get the Business app name
Is Business app a variable on your catalog item?
If yes then you can show it in email notification body as this
${variables.variableName}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:39 AM
Hi @Ankur Bawiskar Business Application is a variable on my catalogue item. However, can you dot walk within a variable?
I'm wanting to show the Business Owner, which comes from the Business Application table.
I'm also trying to implement the following mailing script, but I don't know where I'm going wrong:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:40 AM
this will work
var lab = current.variables.new_lab_department.getDisplayValue();
var platform = current.variables.new_platform.getDisplayValue();
if(lab != null && platform != null) {
template.print(lab);
}
if(lab == null && platform != null) {
template.print(platform);
}
// Add your code here
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:49 AM
Hi @Ankur Bawiskar When I try that, it works if the lab is populated, but it doesn't work when the lab is not populated and the platform is populated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 04:51 AM
you have given AND condition for both not empty
give only specific one
var lab = current.variables.new_lab_department.getDisplayValue();
var platform = current.variables.new_platform.getDisplayValue();
if(lab != null) {
template.print(lab);
}
if(platform != null) {
template.print(platform);
}
// Add your code here
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader