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
Judith Randall 12Judith Randall 12 

Scheduled flow fails on schedule but runs in debug

Hi.
I have a scheduled flow that loops through specific tasks created in the last 24 hours and checks if the contact exists, and if the campaign member exists and if it doesn't, it adds a new campaign member. When I run it in debug mode it works fine.  However, when it runs on schedule it is failing as it is trying to create the campaign members multiple times (around 11,000 times !).  When I look through the log (which is too long to post), it is only running through each task once and working perfectly. In this example just 21 tasks to loop through. So when running in debug mode, it is identical except it only tries to create one of each record and doesn't fail.

Has anyone come across something like this before? Are there any specific differences between running in debug mode and running in schedule mode?

This is the flow, it is fairly basic:
User-added image
Not sure what else I can provide to help, This is an excerpt from the log on a record that is trying to create multiple times:

Loop Through: [00T0600004WVxFyEAL,00T0600004WVxR1EAL,00T0600004WVxUPEA1,00T0600004WVxUWEA1,00T0600004WVxuwEAD,00T0600004WVy5aEAD,00T0600004WVyO8EAL,00T0600004WVzOzEAL,00T0600004WVzwFEAT,00T0600004WW0G8EAL,00T0600004WW0QgEAL,00T0600004WW0pgEAD,00T0600004WW0wtEAD,00T0600004WW1MpEAL,00T0600004WW38bEAD,00T0600004WW3OOEA1,00T0600004WW3hqEAD,00T0600004WW5UYEA1,00T0600004WW5XtEAL,00T0600004WW5hDEAT,00T0600004WW7ODEA1,00T0600004WW9mOEAT]
Iteration: 2
Current iteration item: 00T0600004WVxUPEA1
GET RECORDS: Get_Contact
Find one Contact record where:
Phone_No_Spaces__c Contains {!LoopThrough.NVMContactWorld__Customer_Number__c} (+44numberremoved)
Result
Successfully found record.
{!ContactID} = 0031o00001vT9pZAAS
DECISION: Contactisnotnull
Outcome executed: ContIsNotNull
Outcome conditions:
{!ContactID} (0031o00001vT9pZAAS) Is null false
GET RECORDS: CampMemberExists
Find one CampaignMember record where:
CampaignId Equals {!LoopThrough.CampaignID__c} (7011o0000016RfmAAE)
AND ContactId Equals {!ContactID} (0031o00001vT9pZAAS)
Result
Failed to find record.
DECISION: DoesMemberAlreadyExist
Outcome executed: CampMembdoesnotExist
Outcome conditions:
{!CampaignMemberID} (null) Is null true
ASSIGNMENT: AssignIndividual
{!CampaignMemberSingle.CampaignId} Equals {!LoopThrough.CampaignID__c}
{!CampaignMemberSingle.ContactId} Equals {!ContactID}
{!CampaignMemberSingle.How_Member_Added__c} Equals {!AddedBy}
Result
{!CampaignMemberSingle.CampaignId} = "7011o0000016RfmAAE"

Many thanks in advance for any help.
Judith Randall 12Judith Randall 12
Just noticed that when it runs in debug mode, the "ASSIGNMENT" looks different, not sure if this is just different for debug as opposed to automatic though.
User-added image
Eddie PrignanoEddie Prignano
I'm sorry I can't help, but I am having the exact same issue.  I run a SOQL query and get results, run it in Debug and get the same number of results, but then when it actually runs, even just a few minutes after I ran the Debug, it gets zero results.  
Eddie PrignanoEddie Prignano
May not be the exact same issue, but yeah.