[SalesForce] Process Builder formula only partially evaluates(Edited version after trying with one of the proposed solutions)

I am working on writing a formula inside process builder "Formula Evaluates to true" and it seems my logic is not working.

Suppose I have a following logic:

1 OR 2 OR 3 OR(4 AND 5)

Below is my formula which is I am writing which is not working:

OR(
   OR(
     1,
     2,
     3),
   AND(
     ISNEW(),
    (this is 4)
     5)
)

Ideally combination of 4 AND 5 should comes with OR along 1,2,3. So I deally if an user puts value for fields 1 OR 2 OR 3 OR (4 and 5) process builder should run but right now process builder is only running when either 1,2,3 is filled and 5 is satisfying.

My real requirements:

Either Is_Medicare__pc OR Is_TriCare__pc OR Is_Medicaid__pc OR
Person_s_Age__pc >= 65 is filled on account then process builder
should update one field.

But right now process builder is running when either of Is_Medicare__pc OR Is_TriCare__pc OR Is_Medicaid__pc is filled AND Person_s_Age__pc >= 65.

Below is my formula which I build:

OR(
OR
(
[Account].Is_Medicare__pc,
[Account].Is_TriCare__pc,
[Account].Is_Medicaid__pc
),
AND
(
ISNEW(),
NOT(ISBLANK([Account].Person_s_Age__pc )),
[Account].Person_s_Age__pc >= 65
)
)

Note: Person_s_Age__pc is a formula field on contacts which is not supported by ISCHANGED() so i am using ISNEW() and ISBLANK()

EDIT : I am editing question based upon my recent work which I have done after giving a try to what @o-lexi has suggested.
1. Created one Date Formula field "65th BirthDate"(API NAME- X65th_BirthDate__c)
Formula for this field is as below:

IF( 

AND(
MONTH( Date_of_Birth__pc ) = 2,
DAY( Date_of_Birth__pc ) = 29,
NOT(
OR(
MOD( YEAR( Date_of_Birth__pc ) + 65, 400 ) = 0,
AND(
MOD( YEAR( Date_of_Birth__pc ) + 65, 4 ) = 0,
MOD( YEAR( Date_of_Birth__pc )+ 65, 100 ) != 0
)
)
)
),
DATE( YEAR( Date_of_Birth__pc ) + 65, 3, 1),
DATE( YEAR( Date_of_Birth__pc ) + 65, MONTH( Date_of_Birth__pc ), DAY( Date_of_Birth__pc ) )
)
2. Created one Formula field as "Over 65"
3. Created one time-dependent PB which sets "Over 65" to TRUE after 0 hrs from 65th BirthDate
enter image description here

enter image description here

enter image description here

  1. Modify my existing PB logic as
    OR( 1, 2, 3, Over_65__c )

Still not able to get what I was trying to achieve. If I put Date of birth on account as 15th May 1953 then upon saving 65th Birthday field is populating as 15th May 2018 but checkbox "Over 65"is not getting checked.Since checkbox is not getting checked my logic for updation of field value for "Insurance" to "Education Only" is also not set which I wrote in my another PB.Kindly help me on this issue.I am struggling alot on same from past 2 weeks and realaly running out of all ideas and knowledge. Any help will be greatly appreciated. Many thanks

Best Answer

Based on your comments, it sounds like your issue

But right now process builder is running when either of Is_Medicare__pc OR Is_TriCare__pc OR Is_Medicaid__pc is filled AND Person_s_Age__pc >= 65.

may stem from a misunderstanding of how Process Builder criteria that include formula fields work.

You suggested that Person_s_Age__pc is a formula field based on, presumably, the Birth Date field. Formula fields are calculated each time they're accessed - there's no database event when the calculated value changes. As a result, what your formula:

OR(
   OR(
      [Account].Is_Medicare__pc,
      [Account].Is_TriCare__pc,
      [Account].Is_Medicaid__pc
   ),
   AND(
      ISNEW(),
      NOT(ISBLANK([Account].Person_s_Age__pc)),
      [Account].Person_s_Age__pc >= 65
   )
)

ultimately does is fire when any of the fields Is_Medicare__pc, Is_TriCare__pc, or Is_Medicaid__pc is changed to true, or when a new Person Account is created whose Person_s_Age__pc field at the time of creation is equal to or greater than 65.

If you have a Person Account where any of the fields Is_Medicare__pc, Is_TriCare__pc, or Is_Medicaid__pc is true and that person's birthday passes, making their age hit 65, nothing will happen because that's not a database event.

If you're changing records in the user interface to test this process, the behavior might look like the logic is behaving differently than you expect.

If you want to take action when a person's age ticks over to 65 without a change in the Birth Date field, you would need to either use time-dependent actions in Process Builder or Workflow Rules, or write a Scheduled Apex class to monitor these records.

I personally would probably go the Scheduled Apex route here because I tend to use code-based solutions, but @o-lexi has a clever declarative solution to allow you to do this with an extra formula field via scheduled action in Process Builder.