0

I have a workflow that always fires and can't figure out why. Here is the logic:

  1. We use an incoming email handler to edit records based on a keyword in the email body
  2. I want the workflow to fire only when an unrecognized keyword is received (valid keywords are Yes, No, or Stop and these are received correctly. We store them in a lastcommand__c field converted to lowercase to verify.

Here is the rule: Image of Bad Rule Criteria

Here is the part of the DEBUG log I captured (and action correctly executes, telling the recipient the command they sent was invalid per the configured email action/template). In this case the response was "yes."

21:09:46.0 (101905360)|WF_CRITERIA_BEGIN|[Enrollment: Enrollment27940 a0dq0000001Z5uo]|WHW Unknown RSVP Response Workflow|01Qq00000005bvN|ON_ALL_CHANGES|0
21:09:46.0 (102066068)|WF_RULE_FILTER|[Enrollment : First RSVP Sent equals true] AND
 [Enrollment : RSVP Request Sent Date not equal to ] AND
 ([Enrollment : Last Message Received not equal to yes] OR
 [Enrollment : Last Message Received not equal to no] OR
 [Enrollment : Last Message Received not equal to stop])
21:09:46.0 (102088626)|WF_RULE_EVAL_VALUE|1
21:09:46.0 (102104725)|WF_RULE_EVAL_VALUE|2017-04-18 04:09:11
21:09:46.0 (102111404)|WF_RULE_EVAL_VALUE|yes
21:09:46.0 (102113967)|WF_RULE_EVAL_VALUE|yes
21:09:46.0 (102116639)|WF_CRITERIA_END|true

This DEBUG log shows "" (null) as being the message received, but will also eval to be true if "yes" or "no" or anything else is received. Is this just bad logic, should conditions be changed to a formula, anything else?

6
  • Can you explain the RSVP Request Sent Date and First RSVP Sent used in the workflow.? Also RSVP Request Sent Date will have null value if it's not filled. So use RSVP Request Sent Date not equal to null in your workflow. That makes more sense. Apr 18, 2017 at 4:47
  • one question, every time your record fulfill the WF criteria , it will fire or it will fire only once??
    – Avijit Das
    Apr 18, 2017 at 4:58
  • Yes, just once. But if you change the answer it'll fire again.
    – Mike Stan.
    Apr 18, 2017 at 5:15
  • Both RSVP Sent Date and First RSVP Sent are custom fields. RSVP Sent Date is a date/time that I populate via trigger to ensure we record the date/time the very first message is initiated and is set to null by default. My thinking here is that if the RSVP wasn't sent out to begin with it'll still be null and therefore make the rule not fire (hope this makes sense) First RSVP Sent is a true/false that it was sent and is also updated via trigger, as well.
    – Mike Stan.
    Apr 18, 2017 at 5:19
  • As per my understanding you workflow need to fire lastcommand__c doesn't contain yes or no or stop.If it is your requirement why you are not mentioning this in your criteria.@Mike Stan
    – Pavan tej
    Apr 18, 2017 at 5:54

1 Answer 1

1

Filter Logic should be and not or. No single value can be all of those so or not equals will always eval to true

3
  • So, 1 AND 2 AND 3 and 4 and 5 ?
    – Mike Stan.
    Apr 18, 2017 at 6:09
  • Yup. As long as blank should not fire it as well. Otherwise remove the blank check
    – Eric
    Apr 18, 2017 at 6:09
  • Thanks for the help so far. This is mostly working in that when I receive the initial message to prompt me to reply with my yes/no/stop keyword, the Last_Message_Received in indeed null (it's a new record). I'm going to try 2 things to fix this up perfect: 1) add a condition that looks for Last_Message_Received is not null; or 2) set the initial value for this field to something like "new" so it will never start out as null (and if someone responds with a null keyword, will fire the email triggers I need).
    – Mike Stan.
    Apr 18, 2017 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .