In my previous article about ECL, I’ve discussed the possibilities of using product information in your CMS. This sort of a setup cries out for Dynamic Component Presentations and Broker queries, which isn’t a problem, unless you want to query the ECL Metadata in the Broker.
Category Archives: Development and templating
Cleaning and Extending Dynamic Linking
On a recent project, we had a couple of interesting requirements with regards to link management on the site, one of which was to rid the site of web page file extensions (no page or link should have a .html or other extension, and index pages should also have the index file name removed (so /news/index.html would be shown as /news/).
The site was driven by the Content Delivery OData web service, so the best place to implement this was using a custom tcdl:Link tag. This article I show you how you can easily do this
Quick TBB – Publish Schema/Template/Taxonomy config
On most projects I have worked on, at some point we have needed some Tridion uris in the web application, be it to load keywords from a taxonomy, or executing broker queries for items based on a certain schema ID, and return dynamic component presentations using a given Template uri. This article shows you a simple TBB to publish these config values.
OData – How to Query Multiple Custom Metas
On a recent implementation, a large site fully driven by OData, we ran into a scenario where we wanted to retrieve DCPs based on multiple custom metadata values. We quickly realized that there are some limitations around this. For instance: a component with the following custom meta fields, color and shape, having values ‘blue’ and ‘round’ respectively cannot be retrieved in one OData call. This is because each CustomMetas Key/Value is exposed as a separate entry in the CustomMetas collection, and the OData protocol is limited – doesn’t allow querying across properties of multiple entries (not as an AND at least). However, if there is a will there is a way, and in the article I will show an approach to doing so.
Contents:
Handling the Syntax Clash of Tridion DWT and JSP Expression Language
JSP Expression Language has the same syntax as Tridion’s Dreamweaver field rendering syntax. Â So when you try to render JSP EL in your DWT, the Dreamweaver Mediator replaces it with a blank because it can’t successfully resolve it. Â Here is a quick tip on how to get around this problem.
Content Delivery Web Service (OData) Fundamentals – It’s as easy as 1-2-3!
To me, OData is simply the Broker API exposed as a web service – at least the most popular functionality of the original Broker API. Â This is useful if your website is not .NET or Java based (PHP for instance), or if the app that needs to pull content across the internet or via AJAX, or for some other reason where database calls to the Broker are restricted. Â In this tutorial I cover getting started with OData and also dive into some of the more advanced query string operations.
Â
Tridion Search Engine Integration – Stop re-inventing the wheel
On a recent project, it was required to do a quick integration between Tridion and a search engine (in this case Solr). We needed to push content directly in the index, rather than using a crawling approach, and there were a couple of simple search interfaces, including the ubiquitous one-box search to integrate in the web application.
Sound familiar? It may well do… almost every Tridion project requires integration with some kind of search engine, and I have to confess I am guilty of re-inventing the wheel most of the time, hacking some code from the previous project around to create something that suits the requirement of the next project
This time I thought, lets do it differently – wouldn’t it be great if there was a generic framework for search integration, that could be used on any Tridion Search Engine integration project, which you could configure/extend (controlled hacking!) as required for the particular project requirements?
Raimond Kempees and I have created that framework as an open source project and presented it at this weeks Tridion Community Webinar.
I will follow with some more posts on this project, but as a teaser, our goal is to take your existing (Tridion 2011+) implementation and have you indexing content, and a simple one-box-search running on your site in less than 2 hours, using the out-of-the-box features of the framework, and the open source search engine Solr.
Having fun with Experience Manager, Page Regions and Widgets
I have been working on a demo image for a workshop I had to give about 2013 and Experience Manager. To make it a true educational example, I didn’t just reuse bits of existing implementations, but basically redesigned most from scratch. Keeping an eye on simplicity to make it all easy to explain and thus simple to understand, while still following the best practices. For most this was still quite straight forward, but when crossing the topic of Experience Manager I actually came to a few new insights which I thought where worth sharing.
How to Debug Tridion Workflow
With all the anticipation and excitement of the new 2013 Bundle Workflow coming out, I thought I’d dig into my notes about the regular ol’ single item workflow for those still on pre-2013 systems. Â In this post I discuss some lessons learnt about debugging workflow. Â Note, this is when I was working with Tridion 2009 SP1, but the same should apply all the way up to Tridion 2011 SP1 HR1.
There are a few methods available for troubleshooting your workflow code. There is no way to use a real debugger on the Workflow VB script since there is no way to set breakpoints in the Visio Automatic Activity Script editor. You can instead keep your VB code as light as possible and keep your workflow logic in C#. Â
Attach to Process and Set Breakpoints/Debug Normally
To do this, your code must be outside of VBScript editor in a C# Class Library DLL as mentioned above.
One approach to this is to write a stand-alone executable that you call via the workflow VBScript.  This stand-alone exe would need to impersonate a user on the CM server, but then can do anything you want. And since this is a stand-alone program running from some directory on the server you can deploy it with a PDB file and attach to its process.
Another common practice of writing workflow code is to write a DLL then register it as a COM+ object or drop it into the GAC. Note that with the GAC approach you can’t easily put the PDB into the GAC with it (at least for the x86 architecture; for x64 there is a folder deeply nested somewhere in Windows where you’ll see your DLL,so you can put your PDB next to it). Then we simply use Process Explorer (http://technet.microsoft.com/en-ca/sysinternals/bb896653.aspx) to find the process using your DLL and attach to it.
Print Logging Statements
If you have some logistical challenges with being able to attach to a process, then we need a way to print debug output statements somewhere – the old fashion way of debugging. This “somewhere†can be two places:
- CM Server’s Event Viewer.
- The finish message. However there is a character limit on how big this can be, and your code may never reach the finish statement.
Using Tridion’s Logger to Print Debug Output
This is the sure way of logging your debug output.
If you’ve moved your workflow code away from VBScript into a C# DLL, then:
Logging logger =Â TDSE.GetLogging();
logger.LogEvent("my debug output", EnumSeverity.severityError, EnumEventCategory.EVENT_CATEGORY_WORKFLOW);
You can do the same thing right from the workflow VB script:
Dim logger
Set logger = TDSE.GetLogging()
Call logger.LogEvent("my debug output", 1, 22)
The log messages will appear in the CM server’s Event Viewer log.
If you don’t have sufficient access to the CM server, then you can use the method listed below. However, in order to effectively develop Workflow you need to get that server access and the ability to freely see the CM’s Event Viewer. So convince your PM or IT people to grant you that access or you’ll be burning a lot of rubber spinning wheels rather than getting traction.
Using the Finish Message to Print Debug Output
This is a really cheeky approach to debugging. Do it as a very last resort or while waiting for IT requests to get processed instead of twiddling your thumbs.
Start with one line of code which is:
Call FinishActivity("my debug output", "Next Activity’s Title or TcmId")
Add some code before this line. Any output you want to see should go in “my message†parameter of FinishActivity.
Note: there is a character limit to how large the finish message can be. This is driven by the database column size. So if you try and spit out too much debug output you’ll get an error.
So be warned. This is a way to do some quick one off printouts, but don’t rely on this as the main way to debug your code (Although back in the day I’ve gotten through coding a massive workflow with this approach before I realized TOM provided a logger, duh!)
Again, a much better way to log debug output is to use the Logger that comes with TOM.
Â
Some Workflow Errors and Things to Watch Out For
Position in the Workflow
CurrentWorkItem.ActivityInstance.Position
This one was fun to debug… Actually if you carefully read the TOM API, which I did not, it provides an example of how to find out how many more activities are left in the flow. There actually is a comment in the sample code that mentions that this works only if there are no loopbacks. Be warned! If you have a case where you need to find out what the previous activity was or what the next activity is, you can’t rely on the position that Tridion gives you because if you have a rejection of content that takes you back a few steps, the position still gets incremented.
Object reference not set to an instance of an object
An error occurred while executing the Workflow script.
The Script Engine returned the following information:
SOURCE:
 Line = 41
 Column = 0
 Number = -2147467261
 Source = ContentBloom.Tridion.Workflow
 Description = Object reference not set to an instance of an object.
 HelpContext = 0
caused by: ContentBloom.Tridion.Workflow
and description: Object reference not set to an instance of an object.
Source:
LogScriptError
This isn’t the VB dying; it’s a null reference exception somewhere in your C# code. Unfortunately the error doesn’t tell us where – well it tell us which function is being called by VB and its line number – so throw in a bunch of logging statements into that C# code and see where it bugs out.
Application uses a value of the wrong type for the current operation.
Unable to finish the Workflow Activity (tcm:12-671-131104)
Application uses a value of the wrong type for the current operation.
The CM server’s event viewer may show a few errors with some being a blob of XML. If you look closely you’ll see this message. What it means is that the size of the FinishMessage is too big. The database column for this field has reached its limit.
Simple Release Management with SDL Tridion 2013 and Bundles
I was fortunate to have a preview version the up and coming 2013 release of SDL Tridion to play with. One new feature is Bundles, which is basically a new type of organizational item, which allows you to group together related items, and do operations on them as a whole. Typically this would be putting it through workflow, or publishing them all together in a single transaction, but one nice thing about them is that you can use them however you want to, just add items into a bundle, and use it however you need to.
The new release of Content Porter will also be bundle-aware, which got me thinking that there should be an easy way to keep track of changed items during development using bundles to avoid the pain of keeping track manually. It turns out to be really easy using the Event System.