Add support for Workflow Manager items
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Workflow Manager is now available in Online an Enterprise. Workflow Manager has a REST api to query and create the required items. The root url is a little different for Online and Enterprise so we will want to account for this in creation and deployment: https://developers.arcgis.com/workflow-manager/
I have looked through the api doc and create some test items and this is how I would suggest we approach creating and deploying these items:
**Creation**
- There is not much to a Workflow item data, we can ignore this. The item data will handled automatically when we use the api to create a new workflow during deployment (see below).
- For the Workflow item template we should get all the item properties, resources and thumbnail
- The key initial aspects that define the Worlflow item are the Diagrams and the Job Templates. We can use the following apis to get the Diagrams and Job Templates
- [getDiagrams](https://developers.arcgis.com/workflow-manager/api-reference/rest/get-diagrams/) Will return an array of diagrams infos
- [getDiagram](https://developers.arcgis.com/workflow-manager/api-reference/rest/get-diagram/) Will return the full json for a single diagram based on a given diagramId
- [getJobTemplates](https://developers.arcgis.com/workflow-manager/api-reference/rest/get-job-templates/) Will return an array of job template infos
- [getJobTemplate](https://developers.arcgis.com/workflow-manager/api-reference/rest/get-job-template/) Will return the full json for a single diagram based on a given jobTemplateId
- Using the above we can get all the diagrams and templates and I would propose we store these in the template properties, for example "properties" : { "diagrams": [], "jobTemplates": [] }
- We don't need to look for any specific dependencies with this item type, but at the end of packaging we should use the post processing step to search for variables in the diagrams and jobTemplates. For example there will likely be itemId reference for other templates or portalUrl references in the diagrams and jobTemplates.
**Deployment**
- We can use the [createWorkflowItem](https://developers.arcgis.com/workflow-manager/api-reference/rest/create-workflow-item/) api to create a new workflow item in the users content at the root folder. This handles creating the workflow item, supporting feature layers/view and the associated group.
- New workflows always have an "Introduction to Workflow Manager" Diagram and Job Template as a helpful starting point for new users. As part of the solution deployment we should delete these in the new workflow prior to adding the diagrams and job templates defined in the solution item. We can use the [deleteDiagram](https://developers.arcgis.com/workflow-manager/api-reference/rest/delete-diagram/) and [deleteJobTemplate](https://developers.arcgis.com/workflow-manager/api-reference/rest/delete-job-template/) apis to do this.
- We can use the [createDiagram](https://developers.arcgis.com/workflow-manager/api-reference/rest/create-diagram/) and [createJonTemplate](https://developers.arcgis.com/workflow-manager/api-reference/rest/create-job-template/) apis to add the diagrams and jobTemplates defined in the template properties. We need to create diagrams before the jobTemplates as the jobTemplate will reference a diagram.
- We can then update the item details for the workflow from the template and apply the thumbnail
- We should also move the workflow and associated feature layers/views into the same folder as the solution.
- At the end of the deployment we should run the post-process to do a final replacement of variables in the diagrams and jobTemplates in case there was a cyclical dependency. You can use the [updateDiagram](https://developers.arcgis.com/workflow-manager/api-reference/rest/update-diagram/) and [updateJobTemplate](https://developers.arcgis.com/workflow-manager/api-reference/rest/update-job-template/) apis if an update is required during this post-process.
**Deleting**
- We can use [deleteWorkflowItem](https://developers.arcgis.com/workflow-manager/api-reference/rest/delete-workflow-item/) to handle deleting the workflow and the supporting feature layers/views and group.
I have created some sample items that can be used in testing. The group below contains a workflow, survey123 form and web application. The survey123 form and web application are both referenced in the workflow so it is a good test that they are templatized properly and swizzled on deployment.
[6d45ec5c65464b20aaa5ac9ea4b55579](https://localdeployment.maps.arcgis.com/home/group.html?id=6d45ec5c65464b20aaa5ac9ea4b55579)
Contributor guide
Assessment
This issue has not been assessed yet.