Strongly identify a workflow on runtime, getting output
Hi,
Situation:
In my Silverlight project using the MVVM design, I need to query a ArcGIS Server map service. I created a workflow that will run the query with appropriate security and return an ESRI FeatureSet. I currently have three modules that need to run that workflow.
To run the workflow with input parameters in Geocortex I go as:
<code>
Dictionary<string, object> dict = new Dictionary<string, object>();
dict.Add(ControlsConstants.cWorkflowID, ControlsConstants.cQueryATSQuarterSection);
dict.Add(ControlsConstants.cGeomFilter, geom);
if (WorkflowCommands.RunWorkflowWithArguments.CanExecute(dict))
WorkflowCommands.RunWorkflowWithArguments.Execute(dict);
</code>
To catch the end of the workflow and recuperate my output parameter I go as:
<code>
public void OnImportsSatisfied()
{
EventAggregator.GetEvent<WorkflowCompletedEvent>().Subscribe(HandleWorkflowCompletedEvent);
}
public void HandleWorkflowCompletedEvent(WorkflowCompletedEventArgs args)
{
if (args.Sender.ID == ControlsConstants.cQueryATSQuarterSection)
{
output = args.Args.Outputs;
Some code ...
}
}
</code>
My problem is that I have no way of knowing which instance of this workflow has terminated, since it could have been fired by any of modules any number of times.
Now with the Microsoft workflow, when you create a workflow, you get a WorkflowInstance object which you can use to strongly recognize the workflow you just created.
http://msdn.microsoft.com/en-us/library/ms594868%28v=vs.100%29.aspx
But I have found nothing of the sort with the way the Geocortex workflow function.
<code>public void Execute(object parameter);</code>
As we can see, there is no output as we run the Execute command for workflows.
The only way I see being able to do this with workflows would be actually add an input and an output containing a strong identifier and passing it along in the workflow just for the sake of identifying it.
Is there a way using the Geocortex workflow classes to do this properly?
In this example, I'm only talking about workflows, but for all the commands that Geocortex has, there should a be a way to strongly identify every command. If there already is, can someone please lead me to where it is all documented.
Thank you
Denis Lapierre
-
Hi Denis,
A Workflow can be run with an argument, which you could assign when you invoke the workflow from code. If you give this argument a type of "In/Out", then it will be returned in the Dictionary of results with the Workflow Completed event.
You won't get back an object reference to the original value you assign, so it's best to use a string in there that you can recognize when you get it back again.
/customer/servlet/servlet.FileDownload?file=00P6000000e88PxEAI
Regards,
-Malcolm
0
Please sign in to leave a comment.
Comments
1 comment