#7005
Support 1
Participant

Thank you for your enquiry.

I created a Formativ applet to run your code. Then I opened the GroupWise rule editor (Tools | Rules | select rule | Edit…), and it displays the following filter expression:

Act on items where
(From  contains 'Admin User') OR
(From  contains 'FAX' and Subject  contains 'Received From')

I found that on sending a message with From = ‘Admin User’, the rule did nothing. Same with From = ‘FAX’ and Subject = ‘Received From Bill & Ben’.

Then I tried creating the same rule manually, using the rule editor. Same filter expression, same action, and it works!

I’m told that using parentheses in a filter expression, ie. with FilterGroupMarker() is flaky. It seems to work manually but not via the API.

The following modified version of your applet appears to do the job. As I understand your requirement, the resulting filter condition is not strictly correct (correctness requires parentheses). It just happens to work because of the order of terms in the expression.

  dim hFilter

  hFilter = GroupWise.FilterCreate(fttInbox, true)

  call GroupWise.FilterGroupBegin(hFilter, bopOr)
  call GroupWise.FilterSetText(hFilter, fldFrom, "Admin User", matSubtext, "", "")

  call GroupWise.FilterGroupBegin(hFilter, bopAnd)
  call GroupWise.FilterSetText(hFilter, fldFrom, "FAX", matSubtext, "", "")
  call GroupWise.FilterSetText(hFilter, fldSubject, "Received From", matSubtext, "", "")

  call GroupWise.RuleCreate("", "TEST", racNewItem, "", hFilter, btoDontCare)
  call GroupWise.RuleAddActionForward("", "TEST", "gwadmin", "", "", _
    "Forwarded by Fax Rule", "", "", "")

  ' Delete the filter handle
  GroupWise.FilterDelete(hFilter)

Interestingly, the above works even though FilterGroupEnd() is not used.

I hope this helps you.

Advansys Support