Skip to main content

Posts

Showing posts with the label Workflow

SDL Web 8 Bootcamp

The new version of Tridion is almost here. For the past couple of years, SDL R&D Amsterdam has been working hard on the new set of features in what will be called SDL Web 8. Notice the new naming, no more year in the release and no more mention of Tridion :-(. Still, there is one mention to the old versioning system – 8. Part of the quirks of being an SDL Web MVP, apart from going to Portugal once a year having all expenses paid by SDL, is to have early-bird access to yet unreleased products and to get hands-on exposure on these new features. Message to community: share more! Everybody can become SDL Web MVP! All you need to do is SHARE! So here I am, in rainy Amsterdam, where for the next couple of days, I'll be diving straight into the new SDL Web 8 features: Content as a Service Simpler upgrades Centralized configuration management MicroService architecture for Content Delivery Faster, automated installation and setup REST and separation of concerns BlueP...

Create and Publish Page for Component in Workflow using Core Service

It seems like this use case keeps coming back time and time again. The requirement: when a new Component is in workflow, part of the approval workflow on the Component should be an automatic Page generation (where the Component is placed on the Page) and possibly publishing of the Page for the purpose of previewing the new Component in a Page context. All this while Component is in workflow, so approver can actually see how the Component looks like before approving/rejecting it. The only issue, as described in the previous post, is that it is not possible to add a v0.x Component to a Page, when the Page is in a child Publication. The solution is to do all this programmatically. In the following example, I use the Core Service to create a new Page (with values taken from a Folder metadata, for example) and place the v0.x Component on it. using ( CoreServiceSession coreService = new CoreServiceSession ()) {      if (component.Version < 1)   ...

Demystifying Workflow, Blueprint, Publish and Actions You Can do With Such Items

I was playing around a while ago with some Components in Workflow, in Blueprinted situation, when I noticed some strange behaviour. I was trying to place a v0.x Component (in Workflow) on a Page in a child Publication -- can't do. I was publishing a Component linking to a Component in Workflow. It works, but it will use the values from the last saved 'link-to' Component -- makes sense. But even when publishing with ActivateBlueprint=true, still the last major version of the 'link-to' Component was used. This all triggered me to summarize these weird cases, as follows: A _ new _ Component (version 0.x) in workflow: is visible in its own and child Publications (GUI & API); can be published in its own and/or child Publication (GUI & API using the “ActivateWorkflow” flag). Publishing follows most of the rules we know (DCPs get published, Page republished if published previously), but some don’t actually work as expected: Components “linking-to” the Co...

Workflow GetNextActivityInstance

The following code sample shows how to read the next ActivityInstance in a workflow. Mind you that for this to work, the current Activity has to be finished. Only then a next Activity Instance is created, and can thus be retrieved: /// <summary> /// Get the next ActivityInstance, if there is one. If the current Activity has not finished, there is no next activity. /// </summary> /// <returns></returns> protected ActivityInstance GetNextActivityInstance() {      ActivityInstance activityInstance = CurrentWorkItem.Activity as ActivityInstance ;      ProcessInstance processInstance = activityInstance.Process as ProcessInstance ;      IList < ActivityInstance > activities = new List < ActivityInstance >(processInstance.Activities);      if (activityInstance.Position < activities.Count) { //Position is 1-based          return activi...

Workflow GetNextActivityDefinition

To continue my series of Workflow utility methods, today I'm presenting a way to retrieve the next Activity Definition, relative to the current Activity in the Workflow Process. /// <summary> /// Return the next activity definition, if there is one. /// </summary> /// <returns></returns> protected ActivityDefinition GetNextActivityDefinition() {      ActivityInstance activityInstance = CurrentWorkItem.Activity as ActivityInstance ;      TridionActivityDefinition activityDefinition = activityInstance.ActivityDefinition as TridionActivityDefinition ;      ProcessDefinition processDefinition = activityDefinition.ProcessDefinition;      IList < ActivityDefinition > activityDefinitions = new List < ActivityDefinition >(processDefinition.ActivityDefinitions);      IList < TridionActivityDefinition > nextActivities = null ; ...

Workflow GetLastManualActivityInstance

Sometimes in practice, you need to get the last manual activity of a workflow. This is the last activity that was performed before the current activity and that is not automatic (i.e. was performed by a user). A use case is to retrieve the message that the user completed his manual activity with. /// <summary> /// Return the last manual activity instance from the current process instance /// </summary> /// <returns></returns> protected ActivityInstance GetLastManualActivityInstance() {      ActivityInstance activity = CurrentWorkItem.Activity as ActivityInstance ;      ProcessInstance processInstance = activity.Process as ProcessInstance ;      List < ActivityInstance > activities = new List < ActivityInstance >(processInstance.Activities);      for ( int i = activity.Position - 1; i >= 0; i--) {          Act...

Workflow GetLastActivityInstance

Writing workflows implies sometimes having to navigate back and forth through the different activities. For example for taking the message of the last Activity, or taking the Assignee of the next Activity. This post gives code samples for retrieving the last Activity Instance. This is the previous Activity Instance that was completed before the current one. /// <summary> /// Return the last activity instance from the current process instance /// </summary> /// <returns></returns> protected ActivityInstance GetLastActivityInstance() {     ActivityInstance activity = CurrentWorkItem.Activity as ActivityInstance ;     ProcessInstance processInstance = activity.Process as ProcessInstance ;     IList < ActivityInstance > activities = new List < ActivityInstance >(processInstance.Activities);     for ( int i = activity.Position - 1; i >= 0; i--) {        ...

Workflow FinishActivity

Where you ever annoyed with the ActivityFinish class? Namely, that second parameter nextAssignee of type Trustee  of the constructor? The constructor signature is the following: public ActivityFinish( string message, Trustee nextAssignee, Session session); So what do I pass as nextAssignee? Figuring that out is not easy... Luckily though, you can simply pass null for the assignee and Tridion will then use the user/group that is defined in the Activity Definition (in the Workflow Visio diagram). What if I want to properly assign a nextAssignee? How do I figure out who the next assignee should be? Well, one way I used in the past was to identify the last manual Activity (thus not automatic, because they are performed by the implicit Tridion user as defined in the SDL Tridion Content Manager MMC snap-in / Workflow settings / Automatic Trustee ID ). Then I used this Trustee for the ActivityFinish. Alternatively, as shown by the code-below, I identify the next...