Workflow
Create Workflow via Admin Dashboard





Test of Workflow Trigger



Start the Workflow Programatically
HTTP Workflow



Last updated











Last updated
This is a log from the Workflow for Product Information Creation:
{{ Workflow.Input.ContentItem | json }} - User: {{ User.Identity.Name }}.var workflowTypes = await workflowTypeStore.ListAsync();"workflowTypes": [
{
"id": 52,
"workflowTypeId": "4y8rkbh0xbbchrd9k26tdswpnd",
"name": "Log on Content Creation",
"isEnabled": true,
"isSingleton": false,
"lockTimeout": 0,
"lockExpiration": 0,
"deleteFinishedWorkflows": false,
"activities": [
{
"activityId": "4yshv2dkk07s96v69yg1d94rwe",
"name": "ContentCreatedEvent",
"x": 0,
"y": 60,
"isStart": true,
"properties": {
"ContentTypeFilter": [
"ProductInformation"
],
"ActivityMetadata": {
"Title": "Product Information Creation"
}
}
},
{
"activityId": "4fpj20x90qtmkss8jgdzh0sgna",
"name": "LogTask",
"x": 450,
"y": 50,
"isStart": false,
"properties": {
"ActivityMetadata": {
"Title": "Product Information Creation Log"
},
"LogLevel": "Information",
"Text": {
"Expression": "This is a log from the Workflow for Product Information Creation: {{ Workflow.Input.ContentItem | json }} - User: {{ User.Identity.Name }}."
}
}
}
],
"transitions": [
{
"id": 0,
"sourceActivityId": "4yshv2dkk07s96v69yg1d94rwe",
"sourceOutcomeName": "Done",
"destinationActivityId": "4fpj20x90qtmkss8jgdzh0sgna"
}
],
"properties": {}
}
]// ...
using OrchardCore.Workflows.Services;
namespace OCBC.HeadlessCMS.Controllers;
[ApiController]
[Route("api/v1/product")]
public class ProductController(
// ...
IWorkflowTypeStore workflowTypeStore,
IWorkflowManager workflowManager) : Controller
{
// ...
[HttpGet("trigger-workflow/{contentItemId}")]
public async Task<IActionResult> TriggerWorkflowDemo(string contentItemId)
{
// Load the workflow definition.
var workflowType = await workflowTypeStore.GetAsync(52);
if (workflowType == null)
{
return BadRequest(new { Error = "Workflow not found." });
}
var productInformation = await orchard.GetContentItemByIdAsync(contentItemId);
var input = new Dictionary<string, object>()
{
{ "ContentItem", productInformation },
};
// Invoke the workflow.
var workflowContext = await workflowManager.StartWorkflowAsync(workflowType, input: input);
return Ok(new { workflowTypes, workflowContext });
}
}