Activate Workflow from Results Pane
I'm wondering if it is possible to invoke a workflow while using a URL with a paramater, and be able to pass the parameters from within the short feature description?
So my intention is that there would be a link under the feature description that would run a workflow.
Has anyone tried this before?
If so, could you pass along an example?
Walter
-
Hi Walter,
It is possible to do what you are asking. Here is a sample from my feature description. The one thing you'll need to keep in mind is to have whatever attributes you'd like to pass to the workflow defined as arguments (not variables) in the workflow itself.
Here I am passing the mapServiceID , the name of the layer Traffic Closures (Current) , and the ObjectID to a argument named ClosureOID . These are all used as inputs to a workflow which brings up the attributes for that Traffic Closure for editing purposes.
<div><span style="font-size: 10pt;">{DATE_FROM} - </span><span style="font-size: 10pt;">{DATE_TO}</span></div><div><span style="font-size: 10pt;">Type:</span><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"> </span><span style="font-size: 10pt;">{CLOSURE_TYPE}</span></div><div>Reason:<span class="Apple-tab-span" style="white-space:pre"> </span>{REASON_CODE}</div><div>Status:<span class="Apple-tab-span" style="white-space:pre"> </span>{STATUS_CODE}</div><div><span style="font-size: 10pt;">Name:</span><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"> </span><span style="font-size: 10pt;">{STREET_NAME}</span></div><div><a href="command:RunWorkflowWithArguments?workflowId=Edit_Traffic_Closure&mapServiceID=1 &ClosureLayerName=Traffic Closures (Current) &ClosureOID={OBJECTID} ">Edit this closure</a></div>
Let me know if you have any other questions,
Warren
0 -
Warren,
Thanks for your reply. My workflow has indeed one argument set called: Site_Number_Selected.
<a href="runWorkFlow=Run_Public_Report&Site_Number_Selected={GIS_StoneOrchard.GEOCORTEX.%GIS_cemetery_sites.site_number}">Run Cemetery Report on {GIS_StoneOrchard.GEOCORTEX.%GIS_cemetery_sites.site_number}</a>
But the error I'm receiving is: 404 - File or directory not found. And my url is:
http://gisdev2.greatersudbury.ca/GHV/runWorkFlow=Run_Public_Report&Site_Number_Selected=10-G-9C
Walter
0 -
Hi Walter,
I noticed you're missing a few small things. You'll need to restructure your command to be the following (I've bolded the pieces missing for your reference):
<a href="command: RunWorkflowWithArguments? workflowId=Run_Public_Report&Site_Number_Selected={GIS_StoneOrchard.GEOCORTEX.%GIS_cemetery_sites.site_number}">Run Cemetery Report on {GIS_StoneOrchard.GEOCORTEX.%GIS_cemetery_sites.site_number}
since this workflow is being initiated from a command reference you need to use the command within your href. Also since you are supplying an argument with your workflow action you need to use the version of the RunWorkflow that accomodates these parameters. Also the question mark was missing in the initial command.
Everything else seems fine. Let me know how that works out for you, I'm interested to learn if the argument works out well since I've never used a datalink value to initiate a workflow.
Warren
0 -
Warren,
Initially my work flow was designed so that the user selected a plot in the cemetery through the use of "displaycapturegeometry"
I just added the argument to see if it would work, which it did not.
So I need to amend my workflow and use the "getattributevalues" and pass this to my argument.
Will respond after I've corrected my workflow.
Walter
0 -
Hi Walter,
You could supply an ObjectID through use of a field token, could you not? Again, I may not know exactly what you are trying to achieve with your workflow but if you are just trying to run some activity against the specific feature you could use the ObjectID as a starting point (as I had done in my example). In my workflow, when the user clicks the 'Edit this Closure' workflow button in the feature description I simply supply the ObjectID to a Query Task which then brings me the relevant feature.
Hopefully this might save you some time when configuring your workflow,
Warren
0 -
Warren,
I like your idea better than mine. I was attempting to extract the data link's "Site_Number".
I will follow your suggestion and amend my workflow to incorporate the ObjectID.
Thanks for the suggestion.
Walter
0 -
Warren,
How do you supply the objectID of the selected feature to the query task?
Walter
0 -
Hi Walter,
You'll be able to supply the ObjectID of the feature you are looking to plug into your workflow in the same way as you would supply it to a feature description. In my example from my first post I created a argument named ClosureOID which was really just the ObjectID of the current feature. Therefore, you can supply the ObjectID by plugging {OBJECTID} into your workflow argument string (see my first post).
Then if you want to use this in your workflow I just issued a Query Task in my workflow and created and SQL statement "'OBJECT = ' + ClosureOID. This would then return a featureset contain the feature that you activated the workflow from (the feature description).
Hopefully this helps,
Warren
0 -
Thanks Warren,
That's great. Appreciate your feedback.
Will alter my existing workflow and feed it the ObjectID of the feature already at hand.
Walter
0 -
Warren,
My workflow is not receiving the ObjectID argument for some darn reason. Below is my feature description string and the workflow argument and workflow parameter setup.
<a href="command:RunWorkflowWithArguments?workflowId=Run_Public_Report&Site_Number_Selected={cPlot.OBJECTID}">Run Cemetery Report on {GIS_StoneOrchard.GEOCORTEX.%GIS_cemetery_sites.site_number}</a>
/customer/servlet/servlet.FileDownload?file=00P6000000em1axEAA
/customer/servlet/servlet.FileDownload?file=00P6000000eltmMEAQ
Walter
0 -
Hi Walter,
Replace cPlot.OBJECTID with just plain old OBJECTID . You are essentially just create a plain text string that when the command:RunWorkflow is added as a prefix the viewer acknowledges it and executes the workflow. Therefore, keep in mind that this text string is unaware of layers etc. in your site and won't be able to interpret cPlot.OBJECTID. Rather it will only understand the field token attributes that will be supplied at runtime.
Also since these arguments will be passed at runtime, you won't need to and shouldn't specify anything in the workflow input argument dialog of the manager interface. You should leave this blank.
Let me know how that goes,
Warren
0 -
Warren,
When I replace the cPlot.ObjectID with just ObjectID, I get a warning while in the feature description editor saying that it's an invalid token.
I have also removed the entry from the workflow edit wizard in the site.
So I've placed an alert just before my query but my argument value ie. Site_Number_Selected comes out blank.
It should process the correct layer since I've assembled a query for that specific layer with CemeteryMap = CemeteryPlotMapServiceUrl & "/" & CemeteryPlotLayerID derived from
GetMapServiceInfo.
Thanks for being so patient.
Walter
0 -
Hi Walter,
In the field token drop down, which fields are available? I suspect this isn't an issue with the workflow but just a matter of figuring out which field to supply to it. For instance I used OBJECTID because it was available from my dropdown (below).
/customer/servlet/servlet.FileDownload?file=00P6000000em1YwEAI
Warren
0 -
Warren,
It displays OBJECTID, but when I inserted this token in the href entry line, it comes out as cPlot.ObjectID
Walter
0 -
Hi Walter,
Is the layer you're using in your service based off a shapefile published with a join?
Also does everything work properly in your feature description if you were to put "ObjectID: {cPlot.OBJECTID}"
Warren
0 -
Warren,
Yes, I've published this map service with a data connect to the cemetery database. It's an external table in my .mxd.
And when I added the cPlot.ObjectID to my href command line, it displays the objectID. For example my href looks like this:
Run Cemetery Report on 1-1-20 ObjectID = 50112
So that feature token does yield the cPlot.ObjectID.
Walter
0 -
Warren,
Have a half day off today and am heading home to Guelph.
Appreciate your help.
Walter
0 -
Hi Walter,
I'm going to try this on my end and see if I can replicate the setup (with a join etc...). I'll post back if I'm able to figure something out.
Warren
0 -
Warren,
When I use either the cPlots.ObjectID or just ObjectID, both yield values in my feature description.
But it complains that the {ObjectID} is an invalid token.
Have a good weekend....Walter
0 -
Warren,
Well, I think I've isolated the problem. With all your help, I've got it to run in a Silverlight viewer, but not in Html5 v2.3. Hopefully, after we upgrade to the new Html5 v2.4 this will work.
All along, I've been testing your suggestions with Html v2.3 with no luck at all.
But once I tried it in Silverlight v2.3 it worked.
Thanks for your testing and diligent help.
Walter
0 -
Warren,
Just in case you require this, here's the solution for Html5 viewers.
<a href="http://gisdev2.greatersudbury.ca/GHV/Index.html?run=RunCemteryReport&SiteObjectID={cPlot.OBJECTID}">Run Cemetery Report for {GIS_StoneOrchard.GEOCORTEX.%GIS_cemetery_sites.site_number}</a>
Walter
0 -
Ah that makes sense,
I neglected to ask which viewer you were using, whoops! The "syntax" for both viewers can be found in their respective Administrator and Developer Guides for future reference.
Warren
0
Please sign in to leave a comment.
Comments
22 comments