Extend feature editing with workflow
Hi. I'd like to get some pointers on the best way to create a workflow for editing features in the mobile app. After surveying documentation, I'm not finding this info easily.
My webmap has a feature service with editing enabled. I'm previewing the app with Geocortex Go. So far I have figured out how to add a workflow as a feature action, but there are a couple questions:
1) I'd like to provide a data entry form similar to what is displayed when the user clicks the default 'Edit' button, but with some added logic. I'm not seeing a built in template for edits. Do I have to create that from scratch using WF designer? It would be great to be able to start with a functioning data entry form.
2) Since I'll be providing a custom form for edits, I don't want users to use the default editing capability. How do I hide the default 'Edit' button for a feature?
3) Similar to item 2, I will want to provide a custom workflow for creating new features, and thus, would want to hide the 'Add Feature' button on the left panel, or configure that button to launch my workflow.
Please advise.
Thanks
-
Anyone from Latitude able to provide some guidance here?
0 -
Hi Zorba. The GOOD news is there is a pattern already in place that allows you to 'not use the default' workflow for a specific feature layer and to point the add and edit functionality to that workflow. Per your point 2) and 3) ... once this is done your end users will continue to use the existing Add and Edit buttons ... but it will be your workflow that is run rather than the default.
Per your point 1) We are working on the Create New Workflow templates that will generate a starting point for you. We are also working on exposing this in Designer, but opted to wait until you could create the starting point workflow.
To summarize, with a manually written workflow and some manual configuration in the app.json file for your GXM app you can replace the default workflow for add and/or edit for a feature service with your own.
The configuration to be added to the "$type": "map-extension" is "onAddFeature": "workflow.run-foo" or "onEditFeature": "workflow.run-foo"
Hope that helps get you started.
0 -
Cam, thanks for the reply. So, it sounds like my desired workflow will be feasible with a future release. Great!
In the meantime, I would need to create my workflow from scratch, and then edit the app.json file in order to configure the default edit and add feature buttons to use my workflow. Correct?
And regarding the json config, can you clarify? I'm seeing the following in my app (below). Assuming I have an edit workflow with an item id of "123abc", how should the configuration look?
...
"webMap": "https://www.arcgis.com/sharing/rest/content/items/xxxxxxx",
"$type": "map-extension"
},
{
...
0 -
Hi Zorba - if you are OK with creating the workflow, I'm happy to provide an example configuration for you on how to wire it up.
0 -
Ok, cool. I dont have the workflow done yet, but if you send me the json snippet, I can just plug in my WF once its ready. Thanks.
0 -
When you add your own webmap, Designer will create the map extension and layer extension configuration. You then modify the configuration and add the onAddFeature and/or onEditFeature pieces as well as the workflows that are referenced. Here is a compact example:
{ "$type": "map-extension", "id": "customEditFeatureMap", "webMap": "7e6e4f864d71478689e68347feb52445", "layerExtensions": [ { "id": "dota", "layer": { "layerType": "ArcGISFeatureLayer", "url": "http://mot-portal.latitudegeo.com/arcgis/rest/services/Hosted/Dota/FeatureServer/0" }, "onAddFeature": { "name": "workflow.run", "arguments": { "id": "workflow4" } }, "onEditFeature": { "name": "workflow.run", "arguments": { "id": "workflow1" } } } ], "onClick": [ "tasks.identify", "results.display" ] }, { "$type": "workflow", "id": "workflow1", "portalItem": "96853a91e159482998f69d0cd63e432f", "target": "#taskbar" }, { "$type": "workflow", "id": "workflow4", "title": "Simple Workflow", "target": "#taskbar", "portalItem": "2699c898577d437c8c35ad7412218266" },
0 -
Ok, tried this a few ways but running into an issue. When I try uploading the zip file, I'm getting the error message "The provided .json file contains invalid JSON". It seems like valid json, but the designer app does not like it.
My app.json file format is a bit different from your example. in particular, layerExtensions looked like this:
"layerExtensions": [
"item://layer-extension/63545e84-41cc-4fe9-a8bb-ecc3dac62c0a"
],
after editing, it is like this:
"layerExtensions": [
"item://layer-extension/63545e84-41cc-4fe9-a8bb-ecc3dac62c0a",
{
"onAddFeature": {
"name": "workflow.run",
"arguments": {
"id": "workflow1"
}
},
"onEditFeature": {
"name": "workflow.run",
"arguments": {
"id": "workflow1"
}
}
}
],
Any idea why its not seen as valid?
Attaching the edited app.json file
Thanks
0 -
So, I got the json sorted so that I'm able to upload it successfully (attached), however, I'm still seeing the default workflow when I edit or add new feature.
FYI - my workflow is just a placeholder that shows a display form, for now.
What am I missing?
0 -
Hi Zorba - haven't had a chance to look at this yet ... one of the first things I'd try for troubleshooting is to make the workflow publicly accessible to ensure it isn't a security/access issue.
0 -
Yeah, that's one of the first things I tried. Thanks though.
0 -
Hi Zorba - I solved the mystery. You look to have done it all correctly. Behind the scenes, Designer has a definition for valid configuration elements. While Geocortex Mobile correctly respects these onEditFeature and onAddFeature configuration elements, the behind-the-scenes Designer definition for what is legal hasn't been updated to include them. Therefore, Designer is 'helpfully' removing the undefined configuration.
Here is a link to an example of something that is working (I only did the edit case so I could contrast Edit behavior against Add behavior).
http://www.arcgis.com/sharing/rest/content/items/df015c0a6ae04b59bc7a3ebd1bc066d8/data
The workflow id is 94dbc10a-9bcf-41d6-b8c6-cc5949d67cc9 ... searching for that will take you to the relevant portions of configuration (also below for historical context when that item gets recycled in the future)
Unfortunately the only way I could get this working was to use ago assistant https://ago-assistant.esri.com/ to directly edit the json of the item inside ArcGIS Online (your New Years Resolution was to live more dangerously right?!)
{ "id": "8e05abd7-c1a8-401e-903d-d2d571fae435", "featureSettings": { "formatSettings": { "dateFormat": "D", "fractionalDigits": 2 } }, "taskSettings": { "enableIdentify": true, "enableSearch": true }, "layer": { "$ref": { "id": "CurbRamps_1791", "title": "Curb Ramps", "subtype": null }, "layerType": "ArcGISFeatureLayer" }, "onEditFeature": { "name": "workflow.run", "arguments": { "id": "94dbc10a-9bcf-41d6-b8c6-cc5949d67cc9" } }, "$type": "layer-extension" },
{ "id": "94dbc10a-9bcf-41d6-b8c6-cc5949d67cc9", "title": "language-designer-gen-94dbc10a-9bcf-41d6-b8c6-cc5949d67cc9-title-z1tou4", "portalItem": "https://www.arcgis.com/sharing/rest/content/items/520496eeeec24b7cade87251489ef448", "acceptsUrlParams": true, "target": "#taskbar", "$type": "workflow" },
0 -
Ok, I'll try it with ago-assistant. I think I get it but one question? Where does the workflow id come from - 94dbc10a-9bcf-41d6-b8c6-cc5949d67cc9? Or is that just randomly generated, and I'm free to use any value for my WF id?
Thanks
0 -
I used Designer for as much of it as I could, that ID was auto-generated from Designer and I just left it. You are likely fine to use your own ID to keep it short and simple.
0 -
So, I got this working with your advice so that it launches my dummy WF. One more question (I think) ;-).
How can I get a reference to the current feature (that the user is attempting to edit) in my workflow? From my limited experience, I'm guessing I'd use the 'Get workflow inputs' activity. But is there a property in the app.json file I need to specify to make this work?
I tried adding the context arg like this, but still not working...
{
"id": "simpleWorkflow",
"title": "Edit Feature",
"portalItem": "https://cobgis.maps.arcgis.com/home/item.html?id=1f830ae4a175449688aacb5d78443ae4",
"acceptsUrlParams": true,
"target": "#taskbar",
"commandArgumentInput": "context",
"$type": "workflow"
},
0 -
Any suggestions on this? Thanks.
0 -
Hey Zorba - we have someone looking at this to get you what you need (since I didn't know the answer) They should post some info here for you in the near future.
-Cam
0 -
Thanks
0 -
After some more conversations with Latitude staff, it was recommended to take a different approach. So, rather than configuring the default edit/add buttons to use my own workflow, it's better to just hide those buttons and use other approaches to give users access to my workflows.
Hiding interface elements in not enabled in designer yet, but will be in the next release. For now, I was able to edit the viewer config files directly to hide those buttons.
For the Add feature workflow, I put that into the I want to menu.
For the Edit feature workflow, I added it as a feature action to the desired layer.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
18 kommentarer