Skip to main content
I have created a flow that creates a task upon record creation/update. We have a custom object (Project Detail) that is related to opportunity via a lookup field. If a certain field in the Project Detail is created or updated to meet certain criteria...a task is created on the related opportunity. I have correctly set this up in my flow. My only issue is that any time the Project Detail is updated afterwards, and the flow criteria are met, another (duplicate) task is created. I only want one task created.

 

The solution I tried to implement is to get all of the tasks related to the oppty and store them in a variable. I then loop through them. I then made a decision element and the criteria I chose was to see if the subject on the related tasks in the loop was the same as the task that is being created. If its the same...then I go back to the loop. If the subject is not the same, then I create the task. My logic doesn't appear to be working, though, as duplicate tasks are being created. Thoughts?Create task on opportunity from related custom object with flow ONLY if the task has not already been createdUser-added image
1 resposta
  1. 20 de dez. de 2020, 06:01
    Hey Kyle, 

     

    The reason there are still duplicate Tasks being created is because for every task that does not have the subject you are checking for, you are creating a new Task. For example, if there are already 5 Tasks on the Opportunity and only 1 has the subject, you are looping through all 5, and for 4 out 5 iterations your decision criteria is evaluating to true and therefore creates a Task.

     

    One solution would be to reconfigure your Loop to have the decision check for a Task that does equal the subject you are looking for and if that evaluates to True, assign any value to a variable. Then after your Loop, check if that variable does not equal your chosen value and you can then create the new Task. 

     

    That being said, I believe a more efficient solution would be to choose "Only if the record that triggered the flow to run is updated to meet the condition requirements" for When to Execute Outcome, as that should only create the Task when the specific update you defined are made to Project Detail.

     

    Let me know if that helps or if you'd like some more information.
0/9000