MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (http://forums.pti.com/index.php)
-   Getting Started, Learning, Etc. (http://forums.pti.com/forumdisplay.php?f=38)
-   -   Javascript Syntax Error - FusionPro (http://forums.pti.com/showthread.php?t=5082)

traba5058 February 12th, 2018 11:52 AM

Javascript Syntax Error - FusionPro
 
I have a rule that looks at 2 fields to determine what to return.

I'm getting a Javascript syntax error message on the following rule and for the life of me, I do not see it.

Code:

if ((Rule("RuleEmailFirstName") != "") && Rule("RuleEmailLastName") != ""))
return Rule("RuleEmailFirstName") + "." + Rule("RuleEmailLastName") + "@" + Field("Email Domain");
else if ((Rule("RuleEmailFirstName") != "") && (Rule("RuleEmailLastName") == ""))
return Rule("RuleEmailFirstName") + "@" + Field("Email Domain");
else if ((Rule("RuleEmailFirstName") == "") && (Rule("RuleEmailLastName") != ""))
return Rule("RuleEmailLastName") + "@" + Field("Email Domain");
else
return "";

Will someone please help me and point out what I'm doing wrong?

traba5058 February 12th, 2018 12:02 PM

Re: Javascript Syntax Error - FusionPro
 
All,

I found the error.

Thanks everyone!
Traba

Dan Korn February 12th, 2018 01:14 PM

Re: Javascript Syntax Error - FusionPro
 
You could do it more succinctly:
Code:

return [Rule("RuleEmailFirstName"), Rule("RuleEmailLastName")].filter(String).join(".") + "@" + Field("Email Domain");


All times are GMT -7. The time now is 06:24 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.