Object reference not set to an instance of an object - Workflow customization RRS feed

  • Question

  • Hi guys

    First, I am using Project Server 2010 and MOSS 2010 in a SQL 2008 R2.

    So, I am customizing a new project workflow, and one of this steps is to get a team lead approval.

    To do this one I created a ReadProjectSecurityGroupMember object to read everyone that is on the Team Lead group.

    I used one white paper such as a tutorial.

    Follow the code to Build the approvers, but my team lead variable is returning null, and because this I am receiving this error.

    Does anyone could help me?

    publicGuidTeamLeadGroup = newSystem.Guid(PSSecurityGroup.TeamLeads.ToString());

    ublicstring[] TeamLeads;


    voidBuildApprovers(objectsender, EventArgse)






    CodeActivitySender = (CodeActivity)sender;


    OfficeTaskcurrentApprovers = ((CompositeActivity)Sender.Parent).Parent asMicrosoft.Office.Workflow.Actions.OfficeTask;

                    currentApprovers.AssignedTo = FormatApprovers(TeamLeads);

                    TaskTitle =

    "Revisando projeto "+ projectName[0];






    thrownewException("erro guiiiiiiid "+ TeamLeads[0].ToString() + " error "+ ext.Message.ToString());



    Renato Torres Project Blog - Projetizando

    • Changed type Renato Torres Wednesday, June 20, 2012 1:38 PM question
    Thursday, June 14, 2012 1:28 PM


All replies

  • Well to start,

    Did you specify the TeamLeads array under GroupMembersLoginNames?

    Did you specify the proper Guid variable under SecurityGroupUid?

    Did you specify the WorkflowContext as projectSequence1, WorkflowContext?

    All of these three properties need to be set on the ReadSecurityGroupMember task for it to work.


    Thursday, June 14, 2012 2:37 PM
  • Hi paul,

    Tks for your reply.

    Yes, I did this three steps. Follow the image

    Renato Torres Project Blog - Projetizando

    Thursday, June 14, 2012 4:47 PM
  • OK.

    I see when you throw a new exception you put the name of the first element in the TeamLeads array. Does a person's name actually show up in the exception at runtime? or is it blank?

    Basically im asking if the workflow is even reading anyone from the list. If it IS reading users, then whatever is happening in the FormatApprovers method must be the culprit because the workflow tries to send an email to null address. So if you do see a users name when the exception is thrown, then the Format Approvers function could be your problem (you probably get every user's email in that function, maybe a user doesnt have an email address??)

    This is a weird one


    Thursday, June 14, 2012 7:18 PM
  • Hi Paul,

    Thanks again for your reply.

    So, I could see that the TeamLeads array always returns null.

    I think my problem is when I am associating the TeamLead array with the GroupMembersLoginName.

    And for your knowlodge, my exception wasnt working. So I changed the TeamLeads[0].Tostring() to TeamLeads.Count and I saw that is returning null

    Sorry about my English, I am brazilian and I cant speak very well. I hope you understand! =Dhee


    Renato Torres Project Blog - Projetizando

    Thursday, June 14, 2012 8:17 PM
  • Hi guys

    I discovered that the problem wasn't on the read group security member. Actually the problema was in the read project object.


    Renato Torres Project Blog - Projetizando

    • Marked as answer by Renato Torres Wednesday, June 20, 2012 1:38 PM
    Wednesday, June 20, 2012 1:36 PM