function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeff JobsJeff Jobs 

FLOW Question re: Record Lookup using Date Field and Current Month

Hi,

 

I'm trying to create a FLOW that will lookup specific records based on a date field:

 

"How many Opportunities are there where the date field Closing_Date__c is THIS MONTH"

 

A.  Is this possible in FLOW; and B. If so, how would I go about doing this?

 

Any help would be much appreciated, thanks!

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Jeff JobsJeff Jobs

I ended up builing a loop in my flow so that:

 

It would grab one record at a time, then change that record, then lookup again and grab the next record, then change that record, then lookup again, etc.

 

This made my pool of records smaller and smaller until there were none left.  I used a decision to regulate this process and it worked great!

All Answers

FMDFMD

Yes, this is possible. That is the short answer.

The real question is, "what is your ultimate goal?" The reason for this question is that a report can populate this information more readily. Are you looking for a number of opportunities? A name of the opportunities? Accounts? If you are simply looking for a list of names, IDs, ect, a flow can accomplish this easily.

Jeff JobsJeff Jobs

Thanks for your thoughtful response :)

 

Admit tingly, reports would get me the information I need quicker and easier.  However, my task is to create an interactive payroll process that multiple departments can contribute to.  My vision is to create a FLOW that finds Opportunity records that require a commission to be paid.  The FLOW would need to grab multiple Opportunity records and then store field information from these Opportunity records into multiple variables.

 

I know how to use FLOW to store field information from ONE Opportunity into multiple variables.  I don't know how to store field information from MULTIPLE Opportunities into multiple variables using ONE FLOW.  This is the core of my question.

 

For example: Joe Smith has three deals (Opportunity records) that have not paid him commission yet.  I need a FLOW to find Joe's three deals (based on fields that already exist in my ORG) and then store each of Joe's commission values (these values are found in fields on the opportunity) into three separate variables.  Finally, these three variables will be summed and printed in a payroll record.

 

When I try to do this with a FLOW Record Lookup, I can sort the multiple records (ascending or descending) but the FLOW takes the values from the first or TOP record only.

 

For example:  Find Joe's three opportunities, and sort by the commission amout: descending.  The FLOW is taking the highest commisison amount and storing it in a variable.  What about the second and third highest amounts (located on separted, lookedup records) ; those need to be stored in variables also.  

 

I'd also like to find all of the January 2013(and each subsequent month) Opportunities with a specific commission amount and store those amounts in separate variables:  Like January commission was X, February commission is Y, etc.  Opportunities have deal Month and Year fields already.

 

Ultimately, I need to create a record on a custom object that displays the number of deals that need to paid and the commission amounts. Lookup fields in combination with formula fields will not work as each deal is a separate Opportunity record.  I'd have to have 15 or 20 lookups on one Payroll record that all attach to different Opportunities which just isn't practical.  

 

In addition, I'd like the FLOW to deliver some text like:

 

"Hi Joe, you have THREE deals that will pay a total commission amount of $3000 on the upcoming pay period." and then direct Joe to his own personal payroll record that was created by the FLOW, populated with information found in existing Opportunities.

 

Anyway, I think you get the point.  Directed help in the following areas would be great:

 

A. Using ONE FLOW to grab MULTIPLE records and then store infromation from these records into MULTIPLE variables

B. Recomendation for what I really want to do (located in the paragraph beginning with "Ultimately"

 

Thanks so much for your time and expertise.

 

 

 

 

 

 

Jeff JobsJeff Jobs

I ended up builing a loop in my flow so that:

 

It would grab one record at a time, then change that record, then lookup again and grab the next record, then change that record, then lookup again, etc.

 

This made my pool of records smaller and smaller until there were none left.  I used a decision to regulate this process and it worked great!

This was selected as the best answer