This content has been marked as final. Show 2 replies
Monday bumping this. Anyone know a good with to write a script for IF <attribute> IN <array>? I know how to limit this to one row returned, but it'll give me both the true and false result.
Your #foreach statements are just going to execute 'N' times, once for each value in $robb or $notrobb, and print the corresponding text each time it executes. #foreach statements don't check for a value in an array, they just iterate 'N' times, once for each value in the array. On each iteration, a value is getting assigned to $lead.PostalCode that is probably overwriting (in the context of the script, not in your lead database) the value inherited from the lead record.
Within each #foreach statement, you need a conditional that says #if (condition) Robb #else Not Robb.
So, you really want to do something like:#set( $robb = ["11111", "111", "111111"] )#foreach ($repCode in $robb)
#if ($repCode == $lead.PostalCode)