scottdurow / RibbonWorkbench

Ribbon Workbench 2016 for Dynamics 365
https://ribbonworkbench.uservoice.com/
MIT License
72 stars 24 forks source link

Does the RunWebHook URL for Power Automate flows work across environments? #48

Open sgraflund opened 4 years ago

sgraflund commented 4 years ago

Thank you thank you thank you for creating this awesome feature!

I have been using your Ribbon Workbench tools for years. I figured out how to execute a power automate flow through javascript a few years ago using web requests with a Quick JS button. The only problem was when publishing flows through environments the web url changed.

I ended up creating my own "Properties" entity to store these values throughout environments.

Now with the web hook and power automate flows attached to solutions, is this still an issue? Is the Web URL that's generated for the flow the same between environments?

frick-brian commented 4 years ago

I am not the DEV, but just here putting in an issue of my own...

Do you mean the physical URL to the flow? If so, I believe the address is different per Environment.

Do you use Power Apps solutions to move your flows around? Here is the URL to a flow of mine (GUIDs redacted)

https://us.flow.microsoft.com/manage/**environments/**{GUID}/**solutions/**{GUID}/**flows/**{GUID}/details?utm_source=solution_explorer

So, you can see that the URL string has GUIDs for environment, solutions, as well as flows. So even if the flows GUID is the same (which it should be if you're using solutions), the environment will not be.

As for a flow that is not in a solution, here is the URL for that: https://us.flow.microsoft.com/manage/**environments/**{GUID}/**flows/**{GUID{/details

So, yes, I think the environment itself will always change.

We have similar issues, not really tied to RWB, but having to update flows for every environment to look at the proper CRM and SHarePoint instances. It's very annoying. Hope this helps.

sgraflund commented 4 years ago

Yeah this piece uses an HTTP Request .. in the past moving between environments also created different URL’s for the HTTP Request. If the flow is creating a new URL, then I bet the HTTP request would too.

What I did in the past was wrote javascript to call the web request, but prior to calling that web request I had a “Properties” entity in CRM that held the full web request URL to call. So I wouldn’t have to switch it in each environment on deploy.

Now that I’m using a web hook, I can’t do that .. I’ll have to see if there’s any other way to tie in the appropriate URL into the web hook, maybe as a hidden field on the entity record?

From: Brian Frick notifications@github.com Sent: Friday, July 17, 2020 8:58 AM To: scottdurow/RibbonWorkbench RibbonWorkbench@noreply.github.com Cc: sgraflund sean.graflund.web@live.com; Author author@noreply.github.com Subject: Re: [scottdurow/RibbonWorkbench] Does the RunWebHook URL for Power Automate flows work across environments? (#48)

I am not the DEV, but just here putting in an issue of my own...

Do you mean the physical URL to the flow? If so, I believe the address is different per Environment.

Do you use Power Apps solutions to move your flows around? Here is the URL to a flow of mine (GUIDs redacted)

https://us.flow.microsoft.com/manage/**environments/**{GUID}/**solutions/**{GUID}/**flows/**{GUID}/details?utm_source=solution_explorerhttps://us.flow.microsoft.com/manage/**environments/**%7BGUID%7D/**solutions/**%7BGUID%7D/**flows/**%7BGUID%7D/details?utm_source=solution_explorer

So, you can see that the URL string has GUIDs for environment, solutions, as well as flows. So even if the flows GUID is the same (which it should be if you're using solutions), the environment will not be.

As for a flow that is not in a solution, here is the URL for that: https://us.flow.microsoft.com/manage/**environments/**{GUID}/**flows/**{GUID{/detailshttps://us.flow.microsoft.com/manage/**environments/**%7BGUID%7D/**flows/**%7BGUID%7B/details

So, yes, I think the environment itself will always change.

We have similar issues, not really tied to RWB, but having to update flows for every environment to look at the proper CRM and SHarePoint instances. It's very annoying. Hope this helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/scottdurow/RibbonWorkbench/issues/48#issuecomment-660091999, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHU4MWDLFAP376EB5B2DHWTR4BDFDANCNFSM4OZU42QQ.

scottdurow commented 4 years ago

There is actually some code that I have waiting to get into the smart buttons solution that uses environment variables to configure the flow url - this update should solve your issue. Thank you for the nudge to get this released - I'll work on it asap! For reference, the code is here - https://github.com/scottdurow/RibbonWorkbench/blob/uci-dev/SmartButtonsUCI/SmartButtons.ClientHooks/src/RunWebHook.ts#L5

sgraflund commented 4 years ago

Thanks a bunch Scott! Like I said I absolutely love your tools and have been using them for years. One quick question on the web hook.. What is the return variable that I can use when I throw a 400 error response from a flow?

Sent from Ninehttp://www.9folders.com/


From: Scott Durow notifications@github.com Sent: Friday, July 17, 2020 9:40 AM To: scottdurow/RibbonWorkbench Cc: sgraflund; Author Subject: Re: [scottdurow/RibbonWorkbench] Does the RunWebHook URL for Power Automate flows work across environments? (#48)

There is actually some code that I have waiting to get into the smart buttons solution that uses environment variables to configure the flow url - this update should solve your issue. Thank you for the nudge to get this released - I'll work on it asap! For reference, the code is here - https://github.com/scottdurow/RibbonWorkbench/blob/uci-dev/SmartButtonsUCI/SmartButtons.ClientHooks/src/RunWebHook.ts#L5

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/scottdurow/RibbonWorkbench/issues/48#issuecomment-660113278, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHU4MWE4BMYRHQPZG3G2WW3R4BIGTANCNFSM4OZU42QQ.

sgraflund commented 4 years ago

One other thing worth mentioning, Scott.

One thing I have to write into Quick JS functions is trapping double click events on the button. I do this simply by doing the following:

Var running = false; Function button_Click() { If (running == false) Return;

            //run code here

}

Double click happy users are everywhere.

I haven’t tested this yet with the web hook single or web hook multiple methods .. I’m afraid of duplicate flows running when using this .. especially since I’m using this first on a custom “Create Invoice” button on work orders!

From: Scott Durow notifications@github.com Sent: Friday, July 17, 2020 9:41 AM To: scottdurow/RibbonWorkbench RibbonWorkbench@noreply.github.com Cc: sgraflund sean.graflund.web@live.com; Author author@noreply.github.com Subject: Re: [scottdurow/RibbonWorkbench] Does the RunWebHook URL for Power Automate flows work across environments? (#48)

There is actually some code that I have waiting to get into the smart buttons solution that uses environment variables to configure the flow url - this update should solve your issue. Thank you for the nudge to get this released - I'll work on it asap! For reference, the code is here - https://github.com/scottdurow/RibbonWorkbench/blob/uci-dev/SmartButtonsUCI/SmartButtons.ClientHooks/src/RunWebHook.ts#L5

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/scottdurow/RibbonWorkbench/issues/48#issuecomment-660113278, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHU4MWE4BMYRHQPZG3G2WW3R4BIGTANCNFSM4OZU42QQ.

sgraflund commented 4 years ago

Oops, faulty code. lol

Var running = false; Function button_Click() { If (running == true) Return;

            running = true;
            //run code here

}

From: Sean Graflund Sent: Sunday, July 19, 2020 12:37 AM To: 'scottdurow/RibbonWorkbench' reply@reply.github.com; scottdurow/RibbonWorkbench RibbonWorkbench@noreply.github.com Cc: Author author@noreply.github.com Subject: RE: [scottdurow/RibbonWorkbench] Does the RunWebHook URL for Power Automate flows work across environments? (#48)

One other thing worth mentioning, Scott.

One thing I have to write into Quick JS functions is trapping double click events on the button. I do this simply by doing the following:

Var running = false; Function button_Click() { If (running == false) Return;

            //run code here

}

Double click happy users are everywhere.

I haven’t tested this yet with the web hook single or web hook multiple methods .. I’m afraid of duplicate flows running when using this .. especially since I’m using this first on a custom “Create Invoice” button on work orders!

From: Scott Durow notifications@github.com<mailto:notifications@github.com> Sent: Friday, July 17, 2020 9:41 AM To: scottdurow/RibbonWorkbench RibbonWorkbench@noreply.github.com<mailto:RibbonWorkbench@noreply.github.com> Cc: sgraflund sean.graflund.web@live.com<mailto:sean.graflund.web@live.com>; Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [scottdurow/RibbonWorkbench] Does the RunWebHook URL for Power Automate flows work across environments? (#48)

There is actually some code that I have waiting to get into the smart buttons solution that uses environment variables to configure the flow url - this update should solve your issue. Thank you for the nudge to get this released - I'll work on it asap! For reference, the code is here - https://github.com/scottdurow/RibbonWorkbench/blob/uci-dev/SmartButtonsUCI/SmartButtons.ClientHooks/src/RunWebHook.ts#L5

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/scottdurow/RibbonWorkbench/issues/48#issuecomment-660113278, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHU4MWE4BMYRHQPZG3G2WW3R4BIGTANCNFSM4OZU42QQ.

scottdurow commented 4 years ago

The latest release https://github.com/scottdurow/RibbonWorkbench/releases/tag/SmartButtons.v1.2.435.1 gives some support for Environment Variables - instead of putting the flow URL into the Web Hook Url parameter, you can put a Envrionment Variable in the format {%dev1_myvar%} where dev1_myvar is the schemaname. Annotation 2020-09-11 101138