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.

Problems with showing variables in Notification triggered by Event, triggered by Scheduled Jobs

ronro2
Tera Contributor

Hello guys! 

As the title says. I have problems with showing variables in the Notificiation body (Message HTML). It just doesn't show anything. 

I have a Notification that is triggered by an Event, which in turn is triggered by a Scheduled Jobs. Here comes the code for the Scheduled Jobs: 

var gr_project = new GlideRecord('pm_project');
gr_project.addQuery('active', true);
gr_project.query();
while (gr_project.next()) {
    var manager = gr_project.project_manager.manager;
    if (!gr_project.project_manager.active) {
        var projectLink = gr_project.getLink(false);
        var eventData = "Projektledare: " + gr_project.project_manager.getDisplayValue() + ", Projekt: " + gr_project.getDisplayValue() + ", Projektnummer: " + gr_project.number + ", Länk: " + projectLink;
        gs.eventQueue('vgr_inactive_project_manager', gr_project, manager, eventData);
    }
}

So the variable I want to present in the Notification is the eventData. I have configured the variable like this: 
ronro2_0-1706520565894.png


But nothing shows up in the email previews (I can only see tha placeholder for where the variable is supposed to be) as shown below: 

ronro2_1-1706520642422.png


What am I doing wrong? 

 

Greetings and big thanks in advance!

1 ACCEPTED SOLUTION

Weird
Mega Sage

Well, can't say I've ever seen ${variables} used like so, so I don't know if that's some functionality that's available, but you can either use ${event.parm2} or parse the content in an email script to show something else based on the event content.

View solution in original post

2 REPLIES 2

Weird
Mega Sage

Well, can't say I've ever seen ${variables} used like so, so I don't know if that's some functionality that's available, but you can either use ${event.parm2} or parse the content in an email script to show something else based on the event content.

ronro2
Tera Contributor

Thank you so much! 😄 It helped.