1

Having trouble with automatic decisions in Tridion 2011 SP1.

I have an auto-decision item that go down one of two paths (one to a manual decision and the other to a manual activity). Screenshot attached.

What I need to do is analyse the permissions of the user that submits the first step in the workflow and automatically move the workflow down the correct path.

I am using an event handler for the AutomaticAssignActivity (tested successfully with event log writes) and have found in the API how to finish the activity but there's not overload for assigning the next activity.

I found this post an interesting read and tried to implement the CoreServiceSession and SessionAwareCoreServiceClient but each time the code tries to load the core service I receive the following error: Could not load file or assembly 'Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b' or one of its dependencies. The system cannot find the file specified.

I am using the core service in my web layer for some minor content generation but it doesn't want to work from within the events system. What am I doing wrong? My events system DLL is in the Tridion bin folder where Tridion.ContentManager.CoreService.Client.dll sits.

Any help appreciated :)

Workflow layout

Community
  • 1
  • 1
wardey
  • 169
  • 10
  • 1
    If your first attempt is with VBScript, can you please share your FinishActivity code? I believe all you need is an extra parameter after the finish message and user with the name of the activity. Hopefully someone else can answer your Core Service issue. – Chris Summers Oct 05 '12 at 03:10
  • I'm going to have to go down that route. I remember the command in VBScript however I need to do a fair bit of analysis of permissions which I'd much, much rather do within VS with C#. `Call CurrentWorkItem.ActivityInstance.FinishActivity("Finish message", "Name of activity or TCMID")` – wardey Oct 05 '12 at 04:42
  • Why would you need CoreService here? You can use TOM.NET from your event handler, or TOM from automatic activity? If you could post a code of your event system, people around could help you with making it work. Otherwise, you can always try Fusion log viewer to see where it expects core service dll to be – Andrey Marchuk Oct 05 '12 at 06:45
  • After scouring the web the only example I could find where somebody was directing an automatic decision utilised the service. With the normal Finish() method I can only set the next assignee, not the activity. `DecisionActivityFinishData dafd = new DecisionActivityFinishData(); dafd.Message = "this and that"; dafd.NextActivity = new TridionCore.LinkToActivityDefinitionData() { IdRef = "240" }; dafd.NextAssignee = new TridionCore.LinkToTrusteeData() { IdRef = "11" }; client.FinishActivity(activityInstance.Id, dafd, readOptions);` – wardey Oct 05 '12 at 07:15
  • dafd.NextActivity = new TridionCore.LinkToActivityDefinitionData() { IdRef = "240" }; - this doesn't look right. Can you set it to proper id like "tcm:0-240-131088"? – Andrey Marchuk Oct 05 '12 at 07:43
  • Couldn't get to that code to debug sadly, the Core Service wouldn't get going as mentioned above. I want to find a way to do it with TOM.NET API – wardey Oct 05 '12 at 08:09

1 Answers1

1

Note that if you are developing an Event handler, you should better use the TOM.NET API (it is the preferred API for Event System and templating developments)

For all the rest, use Core Service

If you want to use core service, you can create a .NET DLL and then call it from your automated activity. This thread has some good information about it:

Community
  • 1
  • 1
Puntero
  • 2,310
  • 15
  • 18
  • I am using the TOM.NET API but have not been able to discover (or search online for) a way to set the next activity for the automated decision. The only options for the finish method is setting the next assignee, not activity. Unless I'm overlooking something – wardey Oct 05 '12 at 08:08
  • Ah, so reading that post I can't do this. I have to stick to VBScript – wardey Oct 05 '12 at 08:10
  • @Wardey - I think you have slightly misunderstood. If you are coding in the WF task inside Visio. You need to use VBScript (old TOM). You can call your own COM exposes .NET DLL, but this may only use TOM (not TOM.NET) or CoreService. Additionally you can use the Event System to capture the workflow items moving through the activities. The Event System may use TOM.NET. – Chris Summers Oct 06 '12 at 15:53