Power Automate Exchange

Please login or click SIGN UP FOR FREE to create your FlowUG account to join this user group.
  • 1.  Flow triggered when an opportunity is created runs twice on the same record.

    Bronze Contributor
    Posted Mar 08, 2021 11:06 AM

    I have a Power Automate flow which is triggered when an Opportunity is Created in CRM:

    Trigger Action when an Opportunity is Created

    Here is the underlying code on the trigger:
    {
        "inputs": {
            "host": {
                "connectionName""shared_commondataservice",
                "operationId""SubscribeOnNewItems",
                "apiId""/providers/Microsoft.PowerApps/apis/shared_commondataservice"
            },
            "parameters": {
                "dataset""default.cds",
                "table""opportunities",
                "scope""Business unit"
            },
            "authentication""@parameters('$authentication')"
        }
    }

    This flow was tested in the Sandbox, promoted to production (it is in a solution), and then tested in production with no issues.
    Today, the flow is running twice on the same record when an opportunity is created:

    Run History screen shot
    Basically, this flow:
    1.  generates a value (project id),
    2.  updates the opportunity,
    3.  shares the record with a user specified in a field in the record,
    4.  checks a couple of values in the record and sends notification emails depending on those values.

    Because the flow is only triggered when an item is created, the update action is not re-triggering the flow.  I can also tell that from Run History -- the flow instances are running at the same time.  I discovered this issue when reviewing run history and found that an instance failed during the sharing action because "More than one concurrent Share requests detected for an Entity".  This was because the two flow instances were both trying to share the record at the same time.
    The flow reads a numeric value from a table, uses that value to create a project id, then increments the value and writes back to the table so it is ready for the next project id.
    These duplicate flows are both reading the same value from the table.  This is another reason whey I believe they are running concurrently.

    I am not including the entire flow here because it is a bit lengthy, but am happy to provide more information if it can help someone troubleshoot this.
    I have never seen this behavior before.  it has happened twice this morning.

    Any advice would be greatly appreciated.
    Jim Rinke







    ------------------------------
    Jim Rinke
    Power Platform Specialist
    Katy
    ------------------------------


  • 2.  RE: Flow triggered when an opportunity is created runs twice on the same record.

    Posted Mar 09, 2021 09:08 AM
    Edited by Chad Althaus Mar 09, 2021 09:08 AM
    Hey Jim,

    Looks like this is the same flow where you're using the GrantAccess unbound action?

    As for the duplicate triggering, I have no clue. That is quite bizarre. If I were you, I'd try replacing the trigger with the CDS(ce) connector instead of the classic CDS connector you're using. Perhaps this would give more reliable performance.

    ------------------------------
    Chad Althaus
    Solution Architect Low Code Digital Transformation
    Bray International, Inc.
    Cypress TX
    http://chadalthaus.com/
    ------------------------------



  • 3.  RE: Flow triggered when an opportunity is created runs twice on the same record.

    Bronze Contributor
    Posted Mar 09, 2021 09:14 AM
    Yeah, I'm thinking the same thing, although we tested after promoting to prod and didn't have any issues.  When I built the flow, I used the classic connector because it gave me a function that wasn't available with the new connector, and now I don't remember what that was.   I'll try replacing the trigger and see what happens.

    Thanks!






  • 4.  RE: Flow triggered when an opportunity is created runs twice on the same record.

    Posted May 03, 2021 08:50 AM
    Edited by hardik maru May 03, 2021 08:52 AM

    Hi Jim Rinke, I may sound dumb but I had same kind of problem and I have done following things and this is fixed.

    1) Open the MS FLOW

    2) Change Entity Name to Account Entity and then Save the Flow.

    2) Now Again Change Entity Name to Original One and Save.


    Now Trigger and Check. it will not Trigger Twice anymore. :D :P



    ------------------------------
    hardik maru
    MS CRM DEVELOPER
    ------------------------------