- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 12:14 PM
Hi everyone, I need a bit of help. I am trying to modify an email script that is called from an Incident Alert notification that checks to see if the value of a checkbox is true or false. I am able to template.print the true value to the resulting email, but I cannot for the life of me get an if statement to work so it only prints the value if it is true.
I have a variable on the IA form called u_ialerts_globaloutage. The line below prints out true or false depending on the variable.
template.print ("<br>Global Outage:"+current.u_ialerts_globaloutage+"</br>");
I would assume that the snippit below would only print out if the value is true as the value is confirmed in the line above.
if (current.u_ialerts_globaloutage == 'true'){
template.print("This is a Global Outage");
}
But, i don't get any output from this line on the email that is sent (everything else before and after this is present as expected). I have to be missing something, but after 3 hours of looking over the community & wiki without result I am at a loss.
Thank you in advance
Curtis
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 12:33 PM
Haven't worked with email scripts so this might not apply but if u_ialerts_globaloutage is a boolean value, do you need the single quotes around the value in the if statement?
Should it be:
if (current.u_ialerts_globaloutage == true){...
OR
Couldn't you simplify it to:
if (current.u_ialerts_globaloutage){...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 12:33 PM
Haven't worked with email scripts so this might not apply but if u_ialerts_globaloutage is a boolean value, do you need the single quotes around the value in the if statement?
Should it be:
if (current.u_ialerts_globaloutage == true){...
OR
Couldn't you simplify it to:
if (current.u_ialerts_globaloutage){...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 12:38 PM
You may need to use current.getDisplayValue('u_ialerts_globaloutage) == 'true'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 12:51 PM
Thank you Archie & Kristen! Both of your options worked and accomplished what i was looking for. I am going to mark Archies is correct as it is a slightly cleaner approach, but will also mark Kristens as helpful.
My only regret is not asking earlier . You folks rock.