Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7042221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:08:31+00:00 2026-05-28T02:08:31+00:00

I’m running into an issue with a custom approval workflow that was written in

  • 0

I’m running into an issue with a custom approval workflow that was written in visual studio. It creates an approval task using a custom content type. I developed the workflow on a sharepoint enterprise environment, but the client is trying to run it on a foundation server. The issue I’m running into is when the content type is assigned to the task list. Whenever the workflow is run, I am unable to edit the list item, or update the task item. As soon as I remove the content type from the task list, I can view and edit all of the records just fine. I do get the following event in the logs:

System.NullReferenceException: Object reference not set to an instance
of an object. at
Microsoft.SharePoint.Publishing.CachedListItem.GetWorkflowInfo(SPListItem
item) at Microsoft.SharePoint.Publishing.CachedListItem

To make it more interesting, I was able to run the workflow when the content type was not assigned and get the approval task created, then add in the content type after, then successfully edit and update both records.

And a bit of code…. this is my create task with content type method:

private void createTaskWithContentType1_MethodInvoking(object sender, EventArgs e)
    {
        //set the primary approval task as not completed
        this.primaryApprovalTaskCompleted = false;

        //get the primary approver
        var field = workflowProperties.Item.Fields.GetField("primaryApprover") as SPFieldUser;
        var fieldValue = field.GetFieldValue(workflowProperties.Item[field.Id].ToString()) as SPFieldUserValue;

        createTaskWithContentType1.TaskProperties.AssignedTo = fieldValue.User.LoginName;

        createTaskWithContentType1.TaskProperties.DueDate = DateTime.Now.AddHours(4);

        createTaskWithContentType1.TaskProperties.Title = "Primary Approval for Batch Job ID: " + workflowProperties.Item["batchJobId"].ToString();

        createTaskWithContentType1.TaskProperties.SendEmailNotification = true;

    }

and the xml for my content type:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field ID="{46F9442F-19E3-4818-8FE7-719E5961C8A1}" Name="ApprovalStatus" DisplayName="Approval Status" Type="Choice" Required="TRUE" Sealed="TRUE" Overwrite="True" >
    <CHOICES>
      <CHOICE>Approve</CHOICE>
      <CHOICE>Reject</CHOICE>
    </CHOICES>
  </Field>

  <Field ID="{B485C5E5-A85C-4C09-AE96-F7FC71FB4A3D}" Name="ApprovalNotes" DisplayName="Approval Notes" Type="Text" Overwrite="True" />


  <ContentType ID="0x01080100922FA9051D1C471DA956E627E6B3B81E"
           Name="ApprovalContentType"
           Group="Custom Content Types"
           Description="Approval Content Type"
           Version="0" 
           Overwrite="True">
     <FieldRefs>
      <RemoveFieldRef ID="{a8eb573e-9e11-481a-a8c9-1104a54b2fbd}" Name="Priority" Hidden="TRUE"/>
      <RemoveFieldRef ID="{c3a92d97-2b77-4a25-9698-3ab54874bc6f}" Name="Predecessors" Hidden="TRUE"/>
      <RemoveFieldRef ID="{c15b34c3-ce7d-490a-b133-3f4de8801b76}" Name="Status" Hidden="TRUE"/>
      <RemoveFieldRef ID="{d2311440-1ed6-46ea-b46d-daa643dc3886}" Name="PercentComplete" Hidden="TRUE"/>
      <RemoveFieldRef ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" Hidden="TRUE"/>
      <FieldRef
    ID="{46F9442F-19E3-4818-8FE7-719E5961C8A1}"
    Name="ApprovalStatus" Sealed="TRUE" Required="TRUE"/>
      <FieldRef
    ID="{B485C5E5-A85C-4C09-AE96-F7FC71FB4A3D}"
    Name="ApprovalNotes"/>
    </FieldRefs>

  </ContentType>
</Elements>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:08:32+00:00Added an answer on May 28, 2026 at 2:08 am

    Ok, so the solution for this one… the issue had something to do with the fact that I used a create task with content type object. I was able to replace it with a create task object, then set the content type of the object through code. Still puzzles me as to why this worked on both of my test farms, but failed on my clients…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.