Skip to content

DeleteFlowTaskDef API

Deletes a task definition from the specified workflow step. The workflow definition must be inactive to delete a task definition.

Endpoint

/srv.asmx/DeleteFlowTaskDef

Methods

  • GET /srv.asmx/DeleteFlowTaskDef?AuthenticationTicket=...&DomainName=...&FlowName=...&StepNumber=...&TaskDefId=...
  • POST /srv.asmx/DeleteFlowTaskDef (form data)
  • SOAP Action: http://tempuri.org/DeleteFlowTaskDef

Parameters

Parameter Type Required Description
AuthenticationTicket string Yes Authentication ticket obtained from AuthenticateUser
DomainName string Yes The domain/library name containing the workflow
FlowName string Yes The workflow definition name
StepNumber int Yes The step number containing the task definition
TaskDefId int Yes The ID of the task definition to delete

Response Structure

Success Response

<response success="true" error="" errorCode="0" />

Error Response

<response success="false" error="Error message" errorCode="4000" />

Required Permissions

  • User must be authenticated (valid authentication ticket required)
  • User must have workflow management permissions for the domain
  • The workflow definition must be inactive (not active)

Use Cases

  1. Workflow Task Management
  2. Remove unnecessary or incorrect task definitions from a workflow step
  3. Clean up task definitions before reactivating a workflow

  4. Workflow Redesign

  5. Delete tasks as part of restructuring a workflow step
  6. Remove outdated task assignments from workflow definitions

Example Requests

Request (GET)

GET /srv.asmx/DeleteFlowTaskDef?AuthenticationTicket=abc123-def456&DomainName=MyLibrary&FlowName=ApprovalFlow&StepNumber=1&TaskDefId=42 HTTP/1.1
Host: server.example.com

Request (POST)

POST /srv.asmx/DeleteFlowTaskDef HTTP/1.1
Content-Type: application/x-www-form-urlencoded

AuthenticationTicket=abc123-def456&DomainName=MyLibrary&FlowName=ApprovalFlow&StepNumber=1&TaskDefId=42

Request (SOAP 1.1)

POST /srv.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/DeleteFlowTaskDef"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <DeleteFlowTaskDef xmlns="http://tempuri.org/">
      <AuthenticationTicket>abc123-def456</AuthenticationTicket>
      <DomainName>MyLibrary</DomainName>
      <FlowName>ApprovalFlow</FlowName>
      <StepNumber>1</StepNumber>
      <TaskDefId>42</TaskDefId>
    </DeleteFlowTaskDef>
  </soap:Body>
</soap:Envelope>

JavaScript

Every call answers XML with HTTP 200, success or not, so success is the thing to branch on and errorCode is the number to report.

async function call(action, params) {
  const response = await fetch(`/srv.asmx/${action}?${new URLSearchParams(params)}`);
  const root = new DOMParser()
    .parseFromString(await response.text(), 'text/xml')
    .documentElement;

  if (root.getAttribute('success') !== 'true') {
    throw new Error(`${root.getAttribute('errorCode')}: ${root.getAttribute('error')}`);
  }
  return root;
}

Removes one task definition from a step. TaskDefId is the TaskDefId attribute GetFlowDef reports, and the definition has to be inactive.

const flow = await call('GetFlowDef', {
  authenticationTicket: ticket, DomainName: 'Public', WorkflowName: 'Invoice approval'
});
const taskDefId = flow.querySelector('TaskDef').getAttribute('TaskDefId');

await call('DeactivateFlowDef', {
  authenticationTicket: ticket, domainName: 'Public', flowName: 'Invoice approval'
});
await call('DeleteFlowTaskDef', {
  authenticationTicket: ticket,
  DomainName: 'Public',
  FlowName: 'Invoice approval',
  StepNumber: 1,
  TaskDefId: taskDefId
});

Notes

  • The workflow definition must be inactive before a task definition can be deleted. If the workflow is active, deactivate it first using DeactivateFlowDef.
  • The step must exist within the workflow definition; otherwise an error is returned.
  • If the specified TaskDefId does not exist within the step, an error is returned.
  • AddFlowTaskDef - Add a task definition to a workflow step
  • AddFlowStepDef - Add a step to a workflow definition
  • DeleteFlowStepDef - Delete a step from a workflow definition
  • ActivateFlowDef - Activate a workflow definition
  • DeactivateFlowDef - Deactivate a workflow definition

Version History

  • New: Added to provide programmatic access to workflow task definition deletion previously only available through the Control Panel UI

Error Codes

The errorCode values this operation returns, checked against a running server:

errorCode When
4010 the ticket is expired or unknown
4000 no definition by that name, no task definition by that id, or the definition is still active
4030 the caller may not manage workflows in that library
HTTP 400 a required string parameter was empty; refused by model binding, so there is no error document