[SalesForce] simple process builder failing with error “failed to access the value for variable because it hasn’t been set or assigned”

Note: This error might look like a familiar error but the
resolution mentioned in the salesforce knowledge article is not working in the below case and I am not sure why, hence posting this question.

Problem description:

  1. I have a process builder on case object set to fire for every time new record is created.
  2. Criteria is set to 'Formula evaluates to True' with below formula:
    AND(NOT(ISBLANK([Case].AccountId)),ISPICKVAL([Case].Account.Active__c,'Yes'))
  3. With immediate action set to update custom field on the Case object.
  4. Custom field Active__c on the Account object is type picklist with two possible values 'yes' and 'no'.

Screenshots of the process builder:

enter image description here

enter image description here

enter image description here

Creating a case as shown in the below screenshot with very minimal details and especially not populating account details:

enter image description here

Throws below error:

The flow failed to access the value for
myVariable_current.Account.Active__c because it hasn't been set or
assigned.

Relevant data from log file:

22:14:31.0 (12479016)|WF_FLOW_ACTION_BEGIN|09L370000000FEJ 22:14:31.13
(13607478)|FLOW_CREATE_INTERVIEW_BEGIN|00D37000000H8hr|300370000008ZTl|301370000004weE
22:14:31.13
(15394571)|FLOW_CREATE_INTERVIEW_END|5525dfa7819c33f438ce3cef9b6c15c668d8ff2-3d11|Test
22:14:31.15 (15820974)|FLOW_START_INTERVIEWS_BEGIN|1 22:14:31.15
(16674702)|FLOW_START_INTERVIEW_BEGIN|5525dfa7819c33f438ce3cef9b6c15c668d8ff2-3d11|Test
22:14:31.15 (35470120)|FLOW_ELEMENT_ERROR|The flow failed to access
the value for myVariable_current.Account.Active__c because it hasn't
been set or assigned.|| 22:14:31.15
(35479812)|FLOW_START_INTERVIEW_END|5525dfa7819c33f438ce3cef9b6c15c668d8ff2-3d11|Test 22:14:31.15 (35517783)|FLOW_START_INTERVIEWS_END|Interview error.
Aborting all.|5525dfa7819c33f438ce3cef9b6c15c668d8ff2-3d11|Test
22:14:31.15 (35528335)|FLOW_START_INTERVIEWS_END|1 22:14:31.0
(35588898)|WF_FLOW_ACTION_ERROR|09L370000000FEJ|300370000008ZTl|Error
executing flow: test, FlowDefId: 300370000008ZTl, FlowVersionId:
301370000004weE 22:14:31.0
(35612585)|WF_FLOW_ACTION_ERROR_DETAIL|An unhandled fault has
occurred in this flow

An unhandled fault has occurred while
processing the flow. Please contact your system administrator for
more information. 22:14:31.0
(35683203)|WF_FLOW_ACTION_END|09L370000000FEJ

URL to the complete debug log : https://pastebin.com/J5b7nX7g (Note: You can see from the log that there are no other workflow rules or triggers on the case object).

My analysis:
When the first condition inside the AND expression is evaluating as false, why is it trying to evaluating the second condition to check the custom field on the Account object? It shouldn't right?

Any help?

EDIT: I am looking to solve this using option 'Formula Evaluates to True' only because I have other complex criteria like checking the day(Mon vs Tue and etc) of the case creation.

Best Answer

Ok. I raised ticket with Salesforce on this and they came back saying it is a known issue(After more than a month of back and forth) and updated the Knowledge article with the work around for situations like these where Picklist fields are referenced in the formula.

NOTE: As mentioned in Known Issue W-2763830, this formula syntax does not work when using Formula-Based Criteria and making a cross-object reference to a Picklist field (specifically when using the TEXT or ISPICKVAL functions with the spanning reference to that picklist). If you need to make cross-object reference to a picklist field in Process Builder Criteria, use Condition-Based criteria. If you must use formula-based criteria, use the CASE function when making cross-object references to picklists.

URL to the known issue on this : https://success.salesforce.com/issues_view?id=a1p300000008aUBAAY

URL to the knowledge article: https://help.salesforce.com/articleView?id=000212174&type=1

In my case, I had to change the formula as below using CASE function instead of ISPICKVAL function:

Fails:

AND(NOT(ISBLANK([Case].AccountId)),ISPICKVAL([Case].Account.Active__c,'Yes'))

Works:

AND(NOT(ISBLANK([Case].AccountId)),CASE([Case].Account.Active__c,"Yes",1,0)=1)