How to get values from a event parameters and use them in a notification

matthew_hughes
Kilo Sage

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:

matthew_hughes_0-1736519664875.png

 

I'm trying to use the following code to find any business applications that had been updated at the same time:

matthew_hughes_1-1736519764045.png

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:

matthew_hughes_2-1736519970202.png

 

What I'm finding is that the ${u_business_owner} and ${department} fields are not getting updated:

matthew_hughes_3-1736520046347.png

If somebody can advise what I need to do to retrieve the values, that would be great.

 

 

 

16 REPLIES 16

Ankur Bawiskar
Tera Patron
Tera Patron

@matthew_hughes 

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.

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

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:

var lab = current.new_lab_department.getDisplayValue();
            var platform = current.new_platform.getDisplayValue();

            if(lab != null && platform != null) {
                template.print(lab);
            }
            if(lab == null && platform != null) {
                template.print(platform);
            }
          // Add your code here

@matthew_hughes 

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.

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

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

@matthew_hughes 

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.

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