Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Unanswered

Trigger a flow from within code (that still works after promoting solution)

(0) ShareShare
ReportReport
Posted on by 38

We'd like to trigger a flow from within a model driven app by using code (JavaScript WebResource).

 

We have used HTTP POST as a trigger for our flow and this works by calling the HTTP POST URL from within our code. But, every time we promote our solution (e.g. from DEV to TEST), our code is broken as the HTTP POST URL of our flow has changed. Is there any other way we can trigger a flow from within code that won't break when promoting solutions? Previously, to manually trigger a Workflow, we could use the WorkflowId that remained consistent between environments.

Categories:
  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on at
    Hi @Re: Trigger a flow from within code (that still works after promoting solution)

    Hi @Wauters,

    Unfortunately this isn't supported yet and haven't found a way to preconfigure the POST URLs beforehand when deploying with CDS solutions. It has been a big pain for us to manage through the different environments especially that we have everything automated in Azure DevOps... Here are a couple of workarounds but are more advanced:

    1. Haven't try this yet but hopes this works! Build a PowerShell script that:
      1. runs after your solution import that gets the flow http url with the Flow PowerShell cmdlets
      2. Set the URL in a system configuration entity. If you don't already have one, you can use CDS environment variables
      3. In your JavaScript get the URL by retrieving it from the config entity.
    2. The other method which I used was by leveraging Logic Apps instead of Power Automate where I deployed them with ARM templates and was able to automatically wire up the URLs.
    3. Similar the #1, in your JavaScript reference a configuration entity to retrieve the URL. Manually set the URL in each environment once the flows are deployed in and URLs are known.

     

    I suggest you submit the idea here and I'll vote: https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

    Hope this helps!

  • summitb Profile Picture
    on at
    Re: Trigger a flow from within code (that still works after promoting solution)

    You can create a constant.js where urls for each of the env is stored and add a logic that check if the env is dev or prod.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
stampcoin Profile Picture

stampcoin 17

#2
mmbr1606 Profile Picture

mmbr1606 15 Super User 2025 Season 1

#3
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

Overall leaderboard

Featured topics