I have a custom content type, inheriting from the WorkflowTask content type. I've configured the content type to point to a custom form, but the URLs are not working properly.

    Name="Custom Task Content Type"
    Group="Custom Content Types"
        <FieldRef ID="{5E9EDA01-AFAF-4c6d-A3C4-A44C8418E519}" Name="_ApprovalNotes"/>
        <FieldRef ID="{886F1812-47CE-4cd7-AF93-C57EF5EBD171}" Name="_ApprovalStatus"/>
        <FieldRef ID="{CFB3DE92-106B-4c3e-84D2-9FBC3A3C5921}" Name="_Delegate"/>
        <FieldRef ID="{B923E7D6-7C56-447b-95A9-5CFB7854F7B7}" Name="_taskType"/>
        <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
                <New>_Layouts/project/custom Form.aspx?PageMode=New&amp;WFTask=1</New>
                <Edit>_Layouts/project/custom Form.aspx?PageMode=Edit&amp;WFTask=1</Edit>
                <Display>_Layouts/project/custom Form.aspx?PageMode=Display&amp;WFTask=1</Display>

When adding this content type to the built-in Tasks list, the custom form URLs are not carried over. So in the FeatureActivated event receiver, I have this code:

SPContentType ct = taskList.ParentWeb.AvailableContentTypes[contentTypeName];
if (ct != null)

    SPContentType ct2 = taskList.ContentTypes[contentTypeName];
    ct2.NewFormUrl = "_Layouts/project/custom Form.aspx?PageMode=New&WFTask=1";
    ct2.EditFormUrl = "_Layouts/project/custom Form.aspx?PageMode=Edit&WFTask=1";
    ct2.DisplayFormUrl = "_Layouts/project/custom Form.aspx?PageMode=Display&WFTask=1";

Unfortunately, when I open the workflow task form, the received query string contains the key amp;WFTask rather than WFTask. Why is the ampersand XML encoded and then directly used in the querystring rather than being decoded back to a proper ampersand? How do I fix this?

  • 1
    As a work-around, I'm checking the querystring for the "amp;WFTask" key if "WFTask" is not found - this works, but in my development I've seen cases where the encoding resulted in "amp;amp;amp;WFTask" - as though it had been encoded three times. – Zarepheth Sep 12 '13 at 14:06

Use %26 instead of &. It helped me. Like here:

<Edit>_Layouts/project/custom Form.aspx?PageMode=Edit%26WFTask=1</Edit>
| improve this answer | |
  • Odd that that may work, I would assume the %26 would cause the PageMode parameter to equal Edit%26WFTask=1 rather than giving me two parameters. I may try this in the future, but right now the work-around functions and I'm under a time crunch to finish. – Zarepheth Oct 22 '13 at 12:51
  • When I finally got time to test this (need to resolve became necessary when one of our environments double-encoded the ampersand $amp;amp;WFTask=1) the %26 encoding resolved the problem. – Zarepheth Oct 27 '13 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.