1

I would like to initiate a workflow on a regular basis on specified time. This workflow has to execute a custom activity (business logic in C# code to create the components in Tridion) during its execution. Is it possible to achieve this in Tridion workflow? If not suggest the best way to achieve this?

4

Starting a workflow should be done by some form of external trigger (typically a user creating or editing an item).

To do this in an automated way you would need to write a script/program which can be scheduled to trigger the process. I would consider writing either a windows service (probably overkill) or a power-shell type script (which can be scheduled to run when desired).

Your code should use the Core Service to start the workflow process for the given item. The following snippet may get you started:

StartWorkflowInstructionData startWorkflowInstruction = new StartWorkflowInstructionData();
startWorkflowInstruction.Assignee = new LinkToTrusteeData { IdRef = client.GetCurrentUser().Id };
startWorkflowInstruction.ActivityTitle = message;
startWorkflowInstruction.ProcessInstanceTitle = "ECL ITEM:" + actionType.ToString();
startWorkflowInstruction.Subjects = new[] { new LinkToIdentifiableObjectData { IdRef = bundle.Id } };
try
{
        client.StartWorkflow("tcm:0-" + pubID + "-1", startWorkflowInstruction, new ReadOptions());
    return usingItems.Count() + " items that are using " + itemID + " have been added to a bundle and are now in workflow";
}
catch(Exception e)
{
    return e.Message;
}

This sample adds items to a bundle and starts the workflow (the concept is similar if you are not using bundles). Be careful to check if the item you want to put into workflow is not already in workflow or it will fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.