Ask Search:
Ana BlancoAna Blanco 

Email sent when an expiry date is reached

We have a process sending out an email notification 30 prior to this expiry date:

For example, 30 days before the highlighted date:

User-added image

But as a new visa record has been added, expiring in 2024, is there any condition that can be added so this checks if there is a new record with a later expiry date and not send the visa expiration notification?
Best Answer chosen by Ana Blanco
Tony TrinhTony Trinh

Do I have this context correct? Is this on Contact object with Visa related list? Is your Process Builder firing from your Contact object?

If that is the case, you can use Process Builder on your Visas object to update a field on your Contact object (which you can hide from the Contact layout), let's call it "Latest_Visa_Expiry_Date__c".

Then, you can have your Process Builder for Contacts to reevalute the Scheduled Action since it has not fired yet.

https://help.salesforce.com/articleView?id=workflow_time_action_considerations.htm&type=5

If you change a date field that is referenced by an unfired time trigger in a workflow rule that has been evaluated, Salesforce recalculates the unfired time triggers associated with the rule. For example, if a workflow rule is scheduled to alert the opportunity owner 7 days before the opportunity close date and the close date is set to 2/20/2011, Salesforce sends the alert on 2/13/2011. If the close date is updated to 2/10/2011 and the time trigger hasn't fired, Salesforce reschedules the alert for 2/3/2011. If Salesforce recalculates the time triggers to a date in the past, Salesforce triggers the associated actions shortly after you save the record.

All Answers

Tony TrinhTony Trinh
Ana,

You can add a row in your criteria for something like Visa Expiry Date > CreatedDate + 30 for the Scheduled Action.

Tony
Alekhya ThotaAlekhya Thota
Hi Ana,

Are these Visa records child records or standalone? Is yes, is it a Master-Detail relationship with the Parent?
Ana BlancoAna Blanco
I'm not sure I understand, but here is more info:

The record for the highlighted expiry date was created before the expiry date

old visa: created date 12/07/2017, expiry date 15/10/2019   (I don't want to fire an email)

new visa: created date 03/07/2019, expiry date 31/12/2024  (how do I make it check if there is a newer record created, like this one)
Tony TrinhTony Trinh

Do I have this context correct? Is this on Contact object with Visa related list? Is your Process Builder firing from your Contact object?

If that is the case, you can use Process Builder on your Visas object to update a field on your Contact object (which you can hide from the Contact layout), let's call it "Latest_Visa_Expiry_Date__c".

Then, you can have your Process Builder for Contacts to reevalute the Scheduled Action since it has not fired yet.

https://help.salesforce.com/articleView?id=workflow_time_action_considerations.htm&type=5

If you change a date field that is referenced by an unfired time trigger in a workflow rule that has been evaluated, Salesforce recalculates the unfired time triggers associated with the rule. For example, if a workflow rule is scheduled to alert the opportunity owner 7 days before the opportunity close date and the close date is set to 2/20/2011, Salesforce sends the alert on 2/13/2011. If the close date is updated to 2/10/2011 and the time trigger hasn't fired, Salesforce reschedules the alert for 2/3/2011. If Salesforce recalculates the time triggers to a date in the past, Salesforce triggers the associated actions shortly after you save the record.

This was selected as the best answer
Ana BlancoAna Blanco

Alekhya,

I'm guessing these are child records, because I can see the Visa object is linked to Master Object 'Employee'

Master-detail relationship (not sure what this is) but I cannot use anything like https://workbench.developerforce.com to find out because I'm not allowed.

Ana BlancoAna Blanco
The context is correct. It's on the Employee object with Visa related list. It's not a process builder yet, it's a custom process we have built on visual force but I can try doing the two process builders you suggest for this instead.

I'll give these a go, thank you!
Tony TrinhTony Trinh
I don't know anything about VF, I have yet to learn about that.
Keep in mind, as you implement a Process Builder, they will not retroactively send those emails to all of those records. Those emails will only fire if you make any edits to any records to subsequently meet the conditions. It is wise to implement the Process Builder to update the "Latest_Visa_Expiry__c" date field first before implementing the one on the Employee object.

The only obstacle I see is how you would get the most RECENT date in the Employee field since there are multiple records that may possibly overwrite the latest date. You would probably need an auto-launched flow to achieve the latest date to achieve this.