How can we retrieve workflowParams from an launch workflow ?
Here is my problem:
I'm trying to open a Geocortex Go Application and launch a workflow from a Feature contextual action in another Geocortex Go Application. So, according to what's said in this video, the url, used in the Open URL command, should look like this :
gxm-go://?app=f16d1e6d77164b4ab4b9783ea7f7aed0&workflow=c9cb9d1f-b531-49c9-bad1-513423140847&workflowParams={'arg':context}.
Here is my problem : what should be the correct syntax to pass attributes of my feature from one application to the workflow of the other application ?
And, in the other workflow, how can I retrieve these workflow parameters ?
I tried the "Get Workflow input" and the "Get Application Data" activities, but it's not working as expected.
Any help appreciated !
@Phil MacIntyre? maybe ?
-
Hi Guillaume,
Thank you for your question. I'm glad people are getting value out of our tech tips!
There are a few pieces to the answer here. The first is that the workflowParams values are formatted in standard JSON key:value pairing. You can use an arbitrary value for the key name/s, as you'll just be harvesting that in the second Workflow. The value will correspond to the attribute you want to pass along. I don't think there is a limit on how many pairs you can pack in, so if you want to pass multiple attributes you can do so by just separating each pair with a comma (e.g., workflowParams{'arg1':'Test1','arg2':'Test2','arg3':'Test3}).
For your first app, the one that contains the feature whose data you want to pass to the second app, you want to configure a Workflow and attach it as a feature action to the desired feature layer (don't use the Open URL command directly from Mobile App Designer, as you won't be able to dynamically feed it data). At its simplest, you'll want 3 activities in that feature action Workflow: the Get Workflow Inputs activity, a Create Value activity, and then the Run Command activity. We need to dynamically harvest your attributes, break apart your launch link, and then rebuild it with the attributes being used as the values to pass along. So in brief:
- the GetWorkflowInputs activity will harvest the attributes from your feature
- the Create Value activity will create a single value for the attribute we want to pass along. Add multiple copies of these for additional attributes.
- the Run Command activity (using the system.open-url command) will use your launch link from your second app, and dynamically inject the value from the Create Value activity.
The launch link parameter in the Run Command activity will look something like this:
="gxm-go://?app=0508c168fbd141f3a75f6790603a1702&workflow=24454714-b101-42a2-9d9f-13de28ff66e8&workflowParams={'arg1':'" + $value1.result.toString() + "'}"
So you see I'm taking the launch link for my second app targeting the Workflow I want to run, and then injecting a string value that corresponds to the attribute I want to work with. The system.open-url command looks for strings, so we need to make sure that our values are treated as such.
Then in your second app and its Workflow, at its most basic level you just need to use the GetWorkflowInputs activity again. Whatever key or keys you used in the launch link WorkflowParams will be available as the GetWorkflowInputs output value. In my sample attached Workflow, I'm simply outputting that value to an alert and structuring the alert's input like so:
=$getWorkflowInputs1.inputs.arg1
I'm attaching a zip file that contains 2 JSONs, labelled appropriately for app 1 and app 2 in the scenario described above. This flow takes a feature layer, extracts a 'Description' attribute field, passes it to the second app, and then pops an alert to display it. You could of course build your Workflows out as complex as you would like, but this simple example demonstrates the basic principles.
Please let us know if you have further issues. Thanks again, and have a great day!
0 -
Thank you very much @Phil MacIntyre? , it's working perfectly !
0
Please sign in to leave a comment.
Comments
2 comments