Thread

Index > Scribe > Request filter script example: determining if mail is from a group
Author/Date Request filter script example: determining if mail is from a group
Scott
08/04/2017 10:51pm
In a filter, I've established that an email is from one of a set of contact groups in the Conditions. In the Script, I'd like to do an action based on which contact group the email is from. I get an error when I do the following:
  else if (Mail.From.Groups.Find("Italian") >= 0)
  {
     Print("Italian");
  }

The error is IDomCall warning: Unexpected list member 'Find'.

How should this be done?
fret
12/04/2017 10:03am
The "Groups" field is an array of strings. Not a string, so it doesn't have a "Find" method. To search the array you'd have to iterate over it:
[pre]
grps = Mail.From.Groups;
for (i=0; i<grps.Length; i++)
{
if (grps[i].Find("Italian") >= 0)
{
found = true;
}
}
Scott
20/04/2017 10:09pm
Thanks, works like a charm.
Reply