Design: Working with Workflows

Modified on Mon, 24 Jun at 10:12 AM

Workflows and process automation is available as part of the enterprise subscription for Altium Designer. They allow you to automate manual tasks, monitor progress and project status. They also allow for designers and stakeholders to be electronically notified at required stages throughout the design cycle, improving efficiency and productivity.


To use workflows in the Nexar API, a pre-requisite is that your workspace has to be configured with Altium 365 Enterprise licensing, and has a workflow under "Project Activities" available to run in your Altium 365 Workspace. 


Accessing your workflows in Altium 365


First, you need to get the Workflow information from your workspace. We will be testing our "Design Review" workflow.

You can access your workflows by clicking Admin > Processes > Project Activities:

You can also see any existing processes, under Browser:


We currently have one processes underway.


Using the Nexar API

In the Nexar API, we will be making use of:

the query: desWorkspaceByUrl, 

the mutation: desLaunchWorkflow,
the mutation: desTerminateWorkflows


desWorkspaceByUrl

We use this query to access the available workflows in our Workspace.


From this query, make sure to take note of the:

    projectId

    workflowDefinitionId

variable constraint - if "constraint": "required", take note of the:

    variable name

    variable value 


query getWorkflows {
  #Enter workspaceURL
  desWorkspaceByUrl(workspaceUrl: "https://altium-inc-123.365.altium.com") {
    name
    projects {
      #Take note of the projectId
      id
      name
    }
    workflowDefinitions {
      name
      #Take note of the workflowDefinitionId
      workflowDefinitionId
      variables {
        #If "constraint": "required", take note of the name and value for desLaunchWorkflow
        constraint
        name
        value
      }
    }
    #Any existing workflows will show here
    workflows {
      workflowId
      status
      name
    }
  }
}


Response:

{
  "data": {
    "desWorkspaceByUrl": {
      "name": "Collaboration Workspace",
      "workflowDefinitions": [
...
        {
          "name": "Design Review",
          "workflowDefinitionId": "Process_163566456409:1:973",
          "variables": [
            {
              "constraint": "required",
              "name": "PROJECT",
              "value": ""
            }
...
      ]
    }
  },
  "extensions": {
    "requestId": "225b0b43-c1db-4cb4-ad5a-86afe50534b1"
  }
}


Next, you can use the mutation, desLaunchWorkflow.

This mutation takes the as inputs the:

   workspaceUrl

   workflowDefinitionId

and any variables that are required by that workflow in order to run.


mutation startWorkflow {
  desLaunchWorkflow(
    input: {
      workspaceUrl: "https://altium-inc-123.365.altium.com"
      workflowDefinitionId: "Process_163566456409:1:973"
      variables: [
        { name: "PROJECT", value: "AAAA-123-123-9999-AAAAAAA" }
        {
          valueType: "string"
          constraint: "required"
          name: "Name"
          value: "1test"
        }
        {
          valueType: "enum"
          constraint: "required"
          name: "DESIGN_REVIEW_MODE"
          value: "WIP"
        }
      ]
    }
  ) {
    status
    id
  }
}


Response:

{
  "data": {
    "desLaunchWorkflow": {
      "status": 0,
      "id": "10705"
    }
  },
  "extensions": {
    "requestId": "8dbc8c98-b9bb-422c-80e7-f0c1894dfef4"
  }
}

Take note of the "id" : "10705". This will be used to terminate the workflow.


Now, you can check the statuses of your processes by clicking Admin > Processes > Browser. You should see the new process that you just started:

We can see that there are now two processes underway.


Terminating your workflow


To end the workflow, you can click the red X under terminate in your browser:


Using the Nexar API, you can use desTerminateWorkflows.

This requires the inputs:

    workspaceUrl

    workflowIds


mutation terminateWorkflow {
  desTerminateWorkflows(
    input: {
      workspaceUrl: "https://altium-inc-123.365.altium.com"
      workflowIds: ["10705"]
    }
  ) {
    errors {
      message
    }
  }
}


If the mutation ran successfully, you will return a response similar to the below:

{
  "data": {
    "desTerminateWorkflows": {
      "errors": []
    }
  },
  "extensions": {
    "requestId": "2c413e5b-0f97-492c-af1b-8f2e7a41bf58"
  }
}


And if you refresh your browser, you will see that the workflow is no longer active under Browser:




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article