Add support for Workflow Manager items

Open
#875 15 comments 0 reactions 1 assignee View on GitHub

@MikeTschudi is already working on this.

Since Aug 4, 2023.

Assessment

This issue has not been assessed yet.

Description

A - enhancement

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 Will return an array of diagrams infos
    • getDiagram Will return the full json for a single diagram based on a given diagramId
    • getJobTemplates Will return an array of job template infos
    • getJobTemplate 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 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 and deleteJobTemplate apis to do this.
  • We can use the createDiagram and createJonTemplate 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 and updateJobTemplate apis if an update is required during this post-process.

Deleting

  • We can use deleteWorkflowItem 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

Dominant language
TypeScript
Stars
48
Forks
16
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Esri/solution.js

All issues in Esri/solution.js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.