4

I have a custom object 'Invoice' that has a lookup relationship with the Contact object. I want to create a flow that will have two conditions.

  1. Check if the Invoice status is 'Unpaid'
  2. Check the related contact email address is not null.

I defined the first condition but I don't know how to define the second condition because I cannot access the contact email id field.

first screenshot

enter image description here

3 Answers 3

4

You can not reference fields from lookup relations in Flow as of now. But you can create formula field in lookup object and get that formula field if you need to do it.

2

You can not access related record fields directly using Get Records action in flow. To get values from the related record in flow, you can use 2 Get Record actions one for the parent and one for the child. You can filter based on the available record id.

In your case, Having another Get Records to contact object after getting Invoice to access contact email would do the work.

enter image description here

You can assign the contact email to a variable and use that variable to check if the email is present on the parent contact or not. enter image description here

1
  • 1
    What about Governor Limits? He would have to query for the contact for every invoice, right? --> in a loop. If he receives a high number of invoices, querying for all the contacts will reach governor limits, won't it?
    – Gerke
    Sep 22, 2021 at 8:40
-1

I was not able to find the contact field so I tried using process builder and I was able to check the conditions from a process builder and invoke a flow from it below are the screenshots for the same:

enter image description here

enter image description here

Can you try checking this way?

EDIT: As stated in the comment if it needs to be done only via flow then as access to the related record field values is not possible the one possible way is to use a get record flow element to get the contact record and then use a decision element to check the email emptiness.

2
  • Thanks for the answer. Yes we can achieve this in process builder but for learning purposes I want to know how it is done using flow.
    – Sameer Ali
    Jan 17, 2021 at 2:53
  • 2
    One possibility is to use a get record to get the contact record using the get record element and then use a decision element to check the email emptiness.
    – Anutej
    Jan 17, 2021 at 3:03

You must log in to answer this question.

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