0

I need to pass a few external variables to my Flow app from a GET request. The trigger for the Flow is "Manual trigger" because I want the user to login through Office365 and show them a form with a few options.

Running the flow with extra parameters:

https://foobar-microsoft/run?whitelistName=GPO&controlName=123

I found the variable through the trigger() expression, however it is saved as a string in the Referer attribute. uriQuerg() can return the query but it's still not useful.

Parameters that needs parsing:

?whitelistName=GPO&controlName=123

How do I convert or parse the query to an array or JSON?

atmorell
  • 3,052
  • 6
  • 30
  • 44
  • 1
    I had a similar problem with Blob Storage URLs. I solved it by writing an Azure Function to handle the parsing and returning JSON with the parsed values. Much easier to handle complex parsing requirements that way. – Joel Cochran Mar 18 '20 at 17:46
  • Does this answer your question? [How to get query parameters in a Logic App?](https://stackoverflow.com/questions/51028620/how-to-get-query-parameters-in-a-logic-app) – bvpb Mar 19 '20 at 05:03
  • bvpb, no I am passing parameters in a "Manual trigger" Flow. – atmorell Mar 20 '20 at 10:01

2 Answers2

1

If you are using http request trigger with query parameter, you could check the run history. In the http output you could find there is a json data about queries, you could just select the json data with the key you want.

enter image description here

Use triggerOutputs()['queries'] to get all parameters, use triggerOutputs()['queries']['key'] to get key value.

enter image description here

George Chen
  • 13,703
  • 2
  • 11
  • 26
0

I parsed the Referer URL for parameters with a Powershell Runbook that returns the JSON I need.

First you need the Referer URL - use the trigger() function.

Heres the Runbook

param (
    [Parameter(Mandatory=$true)][String] $url
)

$ErrorActionPreference = 'Stop'
#####################################################################################

$data = @{}
$url = [System.Web.HTTPUtility]::UrlDecode( $url )
$parameters = $url.split('?')[1]

foreach ( $parameter in $parameters.split('&') ) 
{   
    $parameterName = $parameter.split('=',2)[0]
    $parameterValue = $parameter.split('=',2)[1]

    $data.Add( $parameterName,$parameterValue )
}

return $data | ConvertTo-Json

I am I calling a Flow from Power Bi links and passing some GET parameters into the Flow App.

enter image description here

Now I can use the variables in my Flow App

enter image description here

atmorell
  • 3,052
  • 6
  • 30
  • 44