OnPageSetPublishedToPost & Tridion 2011 - tridion

Is the
OnPageSetPublishedToPost
event supported in Tridion 2011. I am having real difficulty getting this event to fire.
I am deploying legacy events system code to Tridion 2011 SP1 HR1.
Thanks,
Chris

Legacy Events handlers, are not fully compatible with Tridion 2011.
TOM event handlers will no longer be triggered for publishing,
resolving and (for Audience Manager contacts import) Keyword save.
The Legacy Event Adapter can help firing some of these events, but unfortunately I think OnPageSetPublishedToPost is not one of them. You can find a lot of useful info on the companion article though
May not be the answer you are looking for, but for this specific event handler you can consider a rewrite to the new event system model. You can mix both old style and new event handlers on the same system.

Try events like the following. This should work. What did you try so far?
EventSystem.Subscribe<PublishTransaction, SaveEventArgs>(YourMethod, EventPhases.TransactionCommitted);
and
EventSystem.Subscribe<Page, PublishEventArgs>(YourMethod, EventPhases.TransactionCommitted);

Related

Which API can I use for writing SDL Tridion workflow activities?

I would like to create workflow using SDL Tridion 2011 SP1, and i am going through the documentation in the live content portal.
I have few questions when I go through the documentation as follows:
Can I use C# (TOM.NET) for automatted activities/decisions? or should I use only VBScript (TOM)? Is there any sample code given in the live content portal for automatted activity/decision?
If C# (TOM.NET) is not allowed to use in workflows, why are its namespace/class/member references given there in TOM.NET API file?
If VBScript only allowed to use in WF, where can I get code/TOM API reference in SDL live content? As of now I dont have access to SDL Tridion server to get the documentation from the installer package.
Can I use C# (TOM.NET) for automated activities? Or should I use only VBScript (TOM)?
You can use the TOM within your C# code to write automated activities. There is a primary interop assembly provided for that purpose (IIRC).
Is use of TOM.NET allowed in workflows?
Accessing workflow items from within existing TOM.NET code (i.e. a TBB or DataExtender) is supported. So you can query items that are in workflow, kick off workflows, etc.. But using the TOM.NET for writing automated workflow activities is not supported.
The reason for this has something to do with incompatible threading models from what I recall. But I mostly just took the word of the developers for it; they are bound to know better than me.
Where can I get code/TOM API reference?
API reference documentation for Tridion is not in LiveContent, but instead is delivered in CHM (or zipped JavaDoc) files. The latest documentation for the TOM API can be found in the "SDL Tridion 2009 full documentation" zip on the Tridion 2009 documentation page on SDL Tridion World (login required).
Thanks to Quirijn and Alvin for pointing this out in the comments.
You can use C# for automated tasks. Create a class and sign it with:
[ProgId("[Namespace].[Class Name]")]
[ComVisible(true)]
And sign the assembly with RegAsm.exe with the /codebase parameter.
Then in the Script of the automated action you can use this object.
Create the workflow diagram (based on the requirement) using visio after installing the visio plugin.
upload the workflow into SDL Content Manager by providing the credentials and choosing the relevant publication.
For automatted activities: create a c# class library and refer the tridion dll's, and user progid and comvisible = true in the solution.
create the necessary functions for your workflow.
register the assembly in the SDL Tridion Content Manager server.
in the workflow "Edit script" use vb script code to get the C# object and its methods.
This will simplify the VBScript code and provide flexibility to the developr to work in c#.
It is fine to use the TOM .Net API. However we must consider that we would need to create Session instances since our new TOM .Net for Workflow won't allow you to pass a WorkItem instance from VBScript (Code Tab in Visio for Automatic Activities) and you are forced to pass the TcmUri for that WorkItem. The session creation is mandatory in order to get Tridion objects instantiated since you just have a tcmuri. The recommendation here is to use the C# class registered as a COM class by using the ComVisible and ProgId attributes but use the CoreServices for all the processing in your Com Visible class.
If you use the Core Services for processing you won't need to take care of sessions creations and your core would be much faster and scalable. You might be interested in use a TCP binding or a Net Pipes binding for performance obviously.

Sample event system code for Tridion 2011 SP1

Right now we are using Tridion 5.3. For number of publications we have event system implemented like sending some mail notification if component is localized, or sending a mail notification when particular activity is completed in workflow process etc.
Our current event system is implementation in Visual Basic 6.0, now when we have to rewrite our code we have to use .NET for the same.
My question is where I can get some sample code for beginners or documentation how event system can be implemented in Tridion 2011 SP1.
These are the top three links when I google for Tridion 2011 event systems:
http://www.sdltridionworld.com/articles/sdltridion2011/sdltridion2011eventsystem.aspx
http://www.julianwraith.com/2011/02/event-systems-in-sdl-tridion-2011/
http://www.curlette.com/?p=90
Each of them is a decent introduction to writing event handlers for Tridion 2011, which in itself is a lot clear/less involved than writing an event system for previous Tridion versions.
If you are having a concrete problem with your Tridion 2011 event handler, I suggest posting the code and describing the problem.
In addition to Frank's excellent suggestions, there is also a sample event handler and full documentation available in the online docs (Username/Password required).

Tridion 2009 Events System to 2011 SP1

Upgrading .Net Events system from Tridion 2009 to Tridion 2011 SP1.
Does anyone have a brief overview of the steps involved?
What is the replacement for Events Config XML file to limit events to particular publications?
I have reviewed the subscribe approach implemented by the new Events system but can events be applied per publication. So far the only approach seems to be implementing publication filter logic in code rather than configuration?
Any input greatly appreciated!
This is a really good place to get started. Written by Bart Koopman
http://www.sdltridionworld.com/articles/sdltridion2011/sdltridion2011eventsystem.aspx
It includes a matrix for mapping old events to the new event phases.
To the best of my knowledge, you still need to choose whether or not to execute your code from within your code depending on the publication. You can not subscribe to a particular event for a specific publication.

TFS and Post-Commit

Does TFS 2010 have an SVN Post-Commit event ?
I want to run a script or an app or do stuff every time a developer checks in something. I've looked over the internet but didn't find something about this.
You will need to create (and publish) a web service and subscribe to the event. DotNetCurry has a decent article on the mechanics of wiring up the event.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=330&AspxAutoDetectCookieSupport=1

ASP.NET Validators inside an UpdatePanel

I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a ASP.NET Validator inside of an update panel does not work. Is there a trick to make these work, or do I need to use the ValidatorCallOut control that comes with the AJAX toolkit?
I suspect you are running the original release (RTM) of .NET 2.0.
Until early 2007 validator controls were not compatible with UpdatePanels. This was resolved with the SP1 of the .NET Framework.
The source of the problem is that UpdatePanel can detect markup changes in your page, but it has no way to track scripts correctly. Validators rely heavily on scripts. During a partial postback, the scripts are either blown away, not updated, or not run when they are meant to.
In early betas, MS had the UpdatePanel try to guess what scripts needed to be re-rendered or run. It didn't work very well, and they had to take it out.
To get around the immediate problem, Microsoft released a patched version of the validator classes in a new DLL called Validators.DLL, and gave instructions on how to tell ASP.NET to use those classes instead of the real ones. If you Google for that DLL name, you should find more information. See also This blog post.
This was a stop-gag measure and you should not use it avoid it if possible.
The real solution to the problem came shortly after, in .NET 2.0 SP1. Microsoft introduced a new mechanism to register scripts in SP1, and changed the real validator classes to use that mechanism instead of the older one.
Let me give you some details on the changes:
Traditionally, you were supposed to register scripts via Page methods such as Page.RegisterStartupScript() and Page.RegisterClientScriptBlock(). The problem is that these methods were not designed for extensibility and UpdatePanel had no way to monitor those calls.
In SP1 there is a new property object on the page called Page.ClientScripts. This object has methods to register scripts that are equivalent (and in some ways better) to the original ones. Also, UpdatePanel can monitor these calls, so that it rerenders or calls the methods when appropriate. The older RegisterStartupScript(), etc. methods have been deprecated. They still work, but not inside an UpdatePanel.
There is no reason (other than politics, I suppose) to not update your installations to .NET 2.0 SP1. Service Packs carry important fixes.
Good luck.
#Jonathan Holland: What is wrong with using Validators.dll?
Since they replace the original classes, you are quietly bypassing any bug and security fixes, enhancements, etc. that Microsoft might release in the future (or might have already released). Unless you look carefully at the web.config, you might never notice that you are skipping patches.
Of course, you have to evaluate each situation. If you are absolutely stuck using .NET 2.0 RTM, then Validators.dll is better than nothing.
#jmein
Actually the problem is that the Validator client script's don't work when placed inside of an updatePanel (UpdatePanels refresh using .innerHTML, which adds the script nodes as text nodes, not script nodes, so the browser does not run them).
The fix was a patch released by microsoft that fixes this issue. I found it with the help of Google.
http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx
If for what ever reason you are unable to use the udpated version of the ASP.NET validator controls is actually very easy to validate a validation group yourself, all you need to do is call
Page_ClientValidate("validationGroupName");
Then you can use the PageRequestManager execute the validation as you need.
Definately using the updated validation controls is the way to go, but I'm quite partial to JavaScript ;)

Resources