- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 01:58 PM
Hi,
I am also struggling with an if statement in the email scripts. I read this post, but wasn't able to resolve my issue: Struggle with 'if' statement in email script
I am trying to get to get certain text to show only if State = Resolved. I have tried many different combinations of if (state == 'Resolved') even putting the values into variables and then comparing the variables. I know the if statement is at lease making an evaluation, because it does print the horizontal line in the else section. I've even used template.print to show the 2 variables and both do say Resolved, but for some reason the if doesn't think that they are equal.
If you have found something that works, please let me know.
Thank you,
Adam Robbins
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 02:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 02:21 PM
Thank you!
I adjusted my variable as follows and it worked
var strState = current.state.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 02:14 PM
Hello Adam,
Please try these recommendations:
- .trim() on the strings
- .valueOf() to convert the string to a primitive
- use '===' instead of '==' ('===' will not do type conversion)
Cheers,