Matching a Local Variable to an Active List in a Rule
I am trying to do some matching against an active list in a standard rule, but I seem to be missing something.
The list I have looks something like this: Columns: active_list_email_prefix, user_role Example: john.smith, administrator John Smith may have multiple email addresses, like email@example.com and firstname.lastname@example.org, which is why I'm matching on the prefix (local part) only.
So, for email fields in events of interest, I'm extracting the prefix with two local variables defined within a single rule (maybe it's better to do this with a velocity template?
atPosition = index_of(Destination User Name, @)
eventEmailPrefix = substring(Destination User Name,0,atPosition)
Then, in the same rule, I'm trying to match the active list rows with a get_activelist_value, which compares active_list_email_prefix with eventEmailPrefix.
Testing the comparison with a known eventEmailPrefix value in the local variable preview area works, but I don't get any matches when testing against actual events. If I assign eventEmailPrefix to a FlexString in an action, it *looks* correct in a test channel.
I'm aggregating on all of the Local Variables, just in case not aggregating could have caused a problem. Can "over-aggregating" cause issues, too?
I have a similar rule working that compares the entire email address event field with another active list that stores the full email address, so I'm leaning toward the local variable assignments as the likely culprit. Am I trying to do too much in a single rule?
Any thoughts or assistance would be greatly appreciated!
Re: Matching a Local Variable to an Active List in a Rule
Thanks for replying.
When I went to get the screenshots, I thought I should double-check a few things, and think I found the issue (though I don't really understand it):
After the matching occurs, I was doing a conditional evaluation to replace NULL values in the list with my own text "Not In List". I'm doing this with the other rule I mentioned and it works fine.
In this case, however, it seemed to think everything was NULL and was always returning "Not In List", which is why I thought the matching wasn't working. When I bypassed the conditional and directly assigned the list values to a FlexString, I got the results I expected.
After playing around with the conditional a bit, I found that testing for NOT NULL works, but testing for NULL doesn't.
So this works:
but this doesn't (always returns Not In List):
Does that make any sense? I must be missing something obvious.
Here are the Actions and Local Variable tabs, in case they help:
Thank again! I appreciate the help.