Saturday, June 14, 2008

CustomAction token bug

Sheetal Jain again comes to my rescue by providing a very quick and easy workaround to an apparent SharePoint 2007 bug regarding tokens in custom actions.  If you use the {ListId} token, it works fine if you are viewing the actual list.  But if you view the list through a WebPart, it does not work.  I found some other posts that came up with workarounds that were quite complicated.  So I was very excited to find his solution.

To sum up, MOSS adds a context object (ctx) to the javascript side of each page.  The object has a property called ListName which is actually the Guid for the list.  So instead of using {ListId}, just concatenate "+ctx.ListName" to your url instead.

Update: This does NOT work if you are in a meeting workspace.  I'll try to post my workaround later.

0 comments: