I am creating a flow to update 2 fields on both lead/contact objects when a campaign member is added/updated. The 2 fields are "oldest campaign" and "newest campaign".
I created 2 variables to hold campaign records called OldestCamVar and NewestCamVar
First I have a decision to see if the campaign that is related to the campaign member that triggered the flow is the correct record type of not
Then I have a Get records element to get Campaign member records that is related to the ContactId and LeadId (I also tried 2nd option to make it equal to the campaign member that triggered the flow) to get the campaigns.
Then I have a loop element to loop through the Collection of records from the element above to assign to a decision. If Current Item.createddated < OldestCamVar.createdDate then assign currentitem as oldestCamVar. Vice versa for newestCamVar. Then outside the loop i have 2 update record elements to update Contact's/lead's 2 fields: "oldest campaign" == OldestCamVar, "newest campaign" == newestCamVar.
The flow is currently not working with error: flow tried to look up records: too many query rows: 50001.
I think the get records element is incorrect but cannot find any alternative to try.