Posted on 27. September 2012

Script# (ScriptSharp) delete statement

I've been using Script# very succesfully for sometime now to generate CRM2011 Javascripts (you can get a version of the Xrm library for Script# at

I problem I encounted recently was where I needed to issue a delete statement. E.g.

delete xmlDoc;

There is only Type.DeleteField support in Script# which allows deleting of a field on an object, but there is no way of outputing a simple local scope delete statement.

I orignally used:

Script.Literal("delete xmlDoc");

This worked fine for debug scripts, however when using the release scripts that are minified, of course the variable xmlDoc is output as something like $1_0 and so the literal statement fails.

After some research I found that the following statement works:

Script.Literal("delete {0}",xmlDoc);

Hope this helps.

Posted on 6. September 2012

O Ribbon, Ribbon! wherefore art thou Ribbon?

Recently, I had to trouble shoot an issue where the Ribbon was not being displayed for a particular entity. When navigating away from the form, the following error was given by CRM 2011:

   <Message>Unable to get value of the property 'attrs': object is null or undefined</Message>

It turns out that this was because of a FlyoutAnchor/SplitButton with no PopulateQueryCommand or Menu Sections added. 

The most recent version of the Ribbon Workbench now has a validation rule that checks you have either of these before publishing.