Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How can I use "Select Variables" in email notification?

appsicumdisplay
Mega Contributor

Hello,

   

        I'm new in SNow and I want to send email notification with some records from table. I have created a business rule, event and email notification, emails are sending properly. Now I want to add some information from a table but I'm confused how can I directly access "Select Variables" beside Message HTML.

I also search but they suggest about email script

I have two table

  • Projects
  • Records(have a reference field of Project Table)

In my business rule:

gs.eventQueue('event_name',current,current.sys_id,project.project_manager);

In my email notification:

I have selected table "Projects"

Select variables are not working in mail as they shows columns of "Project" table

I want to use like this

Project Name: ${name}

Manager: ${manager}

but it shows blank in mails

What I suppose to do now?

How can I use Select variables directly, please suggest me on this.

Thanks-

Macaius

1 ACCEPTED SOLUTION

Slava Savitsky
Giga Sage

From which table do you trigger the email? From "Records" table? If so, this should probably work:



Project Name: ${project.name}


Manager: ${project.manager}



(assuming the reference field pointing to the Project table is called "project")


View solution in original post

4 REPLIES 4

Slava Savitsky
Giga Sage

From which table do you trigger the email? From "Records" table? If so, this should probably work:



Project Name: ${project.name}


Manager: ${project.manager}



(assuming the reference field pointing to the Project table is called "project")


Thank you very much Slava,



Now I understand the concept clearly. That's was I'm looking for.


In my records table I have a reference field(project_name) and I use this in HTML message field like this



Project Name: ${project_name.name}


Manager: ${project_name.manager}



and this is working properly.



Thanks-


Macarius Anna


philbool
Giga Expert

In our instance, we've added a separate email notification script that adds variables as required.  



In the script, we use:



if (current.sysapproval.variable_pool.[variable name]) {


template.print('Variable description:' + current.sysapproval.variable_pool.[variable name]);


}



We then just call the email notification script from your email.   I'd suspect you could use something very similar.


Hello Phil,


        Yes I already did this by email script but I wanted to do this in HTML Message field. BTW thanks for your reply.



Thanks-


Macarius Anna