One of our custom SharePoint Designer workflow activities, which have always worked fine in SharePoint 2007, fails to validate.
This appears to happen when a Workflow Activity that contains a StringBuilder field also contains a lookup variable.
<FieldBind Field="CustomCode" Text="this code" Id="1" DesignerType="StringBuilder" />
For example when we store the following in this StringBuilder field
"Today's date = [%Current Item:Transaction Date%]"
This field returns 'null' in the ActivityValidator. As a result we cannot validate its contents.
When we change the content of this StringBuilder field to
"Today's date = 18/08/2010"
Then we can read the content of this field in the ActivityValidator.
Is this a known bug in SharePoint 2010? Are there any workarounds other than not validating on SharePoint 2010?
Our code is very basic and follows the typical ActivityValidator pattern.
public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
{
try
{
CustomCodeActivity activity = obj as CustomCodeActivity;
... try to read content of StringBuilder field, which fails
// ** Success
return base.Validate(manager, obj);
}
catch(Exception ex)
{
EventLog.WriteEntry(ex);
return compiler.ValidationErrorCollection;
}
}