Configuration service for managing workflow settings
Service for managing workflow instances
// Access workflow instances service
const workflowInstances = tisa.workflow.instances;
// Start a new workflow instance (use tisa.page.listId for the current list GUID)
const startResults = await workflowInstances.start({
workflow: "MyWorkflow",
items: [{ listId: tisa.page.listId, itemId: 1 }]
});
Service for managing workflow tasks
Starts a workflow on the current item or selected items without displaying a dialog. The workflow will be initiated with any provided parameters directly.
The internal name of the workflow to start
Optionalparameters: Record<string, any>Optional parameters to pass to the workflow instance
Promise resolving to an array of workflow start responses indicating success or failure for each item
// Start a simple workflow without parameters
const results = await tisa.workflow.start("SimpleWorkflow");
// Results: [{ status: "Ok", instanceId: "guid-123", itemId: 1, error: null }]
// Start a workflow with custom parameters
const results = await tisa.workflow.start("ApprovalWorkflow", {
approverEmail: "approver@contoso.com",
priority: "High",
dueDate: "2025-02-01"
});
// Results: [{ status: "Ok", instanceId: "guid-456", itemId: 1, error: null }]
// Handle errors
try {
const results = await tisa.workflow.start("MyWorkflow");
results.forEach(result => {
if (result.status !== "Ok") {
console.error(`Failed for item ${result.itemId}: ${result.error?.message}`);
}
});
} catch (error) {
console.error("Workflow start failed:", error.message);
}
Starts a workflow on the specified items without displaying a dialog. The workflow will be initiated with any provided parameters directly.
The internal name of the workflow to start
Array of items (listId and itemId) on which to start the workflow
Optionalparameters: Record<string, any>Optional parameters to pass to the workflow instance
Promise resolving to an array of workflow start responses indicating success or failure for each item
// Start a simple workflow without parameters
const results = await tisa.workflow.start("SimpleWorkflow", [{ listId: "<guid>", itemId: 456 }]);
// Results: [{ status: "Ok", instanceId: "guid-123", itemId: 1, error: null }]
// Start a workflow with custom parameters
const results = await tisa.workflow.start("ApprovalWorkflow", [{ listId: "<guid>", itemId: 456 }], {
approverEmail: "approver@contoso.com",
priority: "High",
dueDate: "2025-02-01"
});
// Results: [{ status: "Ok", instanceId: "guid-456", itemId: 1, error: null }]
// Handle errors
try {
const results = await tisa.workflow.start("MyWorkflow", [{ listId: "<guid>", itemId: 456 }]);
results.forEach(result => {
if (result.status !== "Ok") {
console.error(`Failed for item ${result.itemId}: ${result.error?.message}`);
}
});
} catch (error) {
console.error("Workflow start failed:", error.message);
}
Starts a workflow on the specified items after collecting user input via a dialog form. The dialog is populated with workflow parameters defined in the workflow definition. User-provided form data is merged with optional additional parameters before workflow initiation.
The internal name of the workflow to start
Array of items (listId and itemId) on which to start the workflow
Optionalparameters: Record<string, any>Optional additional parameters to merge with form data (parameters takes precedence)
OptionaldialogConfig: DialogConfigOptional custom dialog configuration for appearance and field definitions If not provided, dialog is auto-generated from workflow parameters
OptionalonDialogButton: OnDialogButtonClickedOptional callback function invoked when dialog buttons are clicked, useful for data validation and transformation
Promise resolving to an array of workflow start responses, or empty array if user cancels the dialog
// Basic usage: start workflow with user-provided form data
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", [{ listId: "<guid>", itemId: 456 }]);
// Opens dialog with default fields, user fills form, workflow starts
// With additional parameters
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", [{ listId: "<guid>", itemId: 456 }], {
source: "automated",
priority: "High"
});
// Form data is merged with these parameters before workflow starts
// With custom dialog configuration
const customDialog: DialogConfig = {
Title: "Custom Approval Form",
Template: [
{ Title: "Approver Email", InternalName: "approverEmail", Type: "Text", Required: true },
{ Title: "Comments", InternalName: "comments", Type: "Note" }
]
};
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", [{ listId: "<guid>", itemId: 456 }], undefined, customDialog);
// With form validation callback
const onDialogButton: OnDialogButtonClicked = async (button, data) => {
if (button === "submit" && !data.approverEmail) {
// Validation failed, dialog stays open
return false;
}
return true; // Allow dialog to close
};
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", [{ listId: "<guid>", itemId: 456 }], undefined, undefined, onDialogButton);
Starts a workflow on the current item or selected items after collecting user input via a dialog form. The dialog is populated with workflow parameters defined in the workflow definition. User-provided form data is merged with optional additional parameters before workflow initiation.
The internal name of the workflow to start
Optionalparameters: Record<string, any>Optional additional parameters to merge with form data (parameters takes precedence)
OptionaldialogConfig: DialogConfigOptional custom dialog configuration for appearance and field definitions If not provided, dialog is auto-generated from workflow parameters
OptionalonDialogButton: OnDialogButtonClickedOptional callback function invoked when dialog buttons are clicked, useful for data validation and transformation
Promise resolving to an array of workflow start responses, or empty array if user cancels the dialog
// Basic usage: start workflow with user-provided form data
const results = await tisa.workflow.startWithForm("ApprovalWorkflow");
// Opens dialog with default fields, user fills form, workflow starts
// With additional parameters
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", {
source: "automated",
priority: "High"
});
// Form data is merged with these parameters before workflow starts
// With custom dialog configuration
const customDialog: DialogConfig = {
Title: "Custom Approval Form",
Template: [
{ Title: "Approver Email", InternalName: "approverEmail", Type: "Text", Required: true },
{ Title: "Comments", InternalName: "comments", Type: "Note" }
]
};
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", undefined, customDialog);
// With form validation callback
const onDialogButton: OnDialogButtonClicked = async (button, data) => {
if (button === "submit" && !data.approverEmail) {
// Validation failed, dialog stays open
return false;
}
return true; // Allow dialog to close
};
const results = await tisa.workflow.startWithForm("ApprovalWorkflow", undefined, undefined, onDialogButton);
Stops running instances of a workflow on the current item or selected items. Resolves running instances on the backend by workflow name + items and stops each one.
The internal name of the workflow whose running instances should be stopped
Promise resolving to an array of stop responses indicating success or failure for each resolved instance
Stops running instances of a workflow on the specified items. Resolves running instances on the backend by workflow name + items and stops each one.
The internal name of the workflow whose running instances should be stopped
Array of items (listId and itemId) whose running instances should be stopped
Promise resolving to an array of stop responses indicating success or failure for each resolved instance
Service for managing workflow operations including starting workflows, retrieving workflow definitions, and handling workflow tasks.
Example