none
Approval tasks is not creating RRS feed

  • Question

  • Hi guys.

    First I am using project server 2010.

    So, I am creating a cutomized workflow to manager my demands. I am using a white paper such as a tutorial, but I have a problem that is driving me crazy.

    I have checked all my code and my flow, apparently it is ok.

    I have 5 stages for my flow: Initiation, Approval, Rejected, Execution and Conclusion.

    In the initiation I have to fill my project chapter.

    In my approval stage I have to obtain least one approve of any team lead. And in this stage that is my problem.

    My workflow is 'jumping' this stage and go directly to repproved stage and my approval tasks are not creating.

    Further information: I can't get the project name, I am receiving a object reference error when I try this one: So,

    TaskTitle = "Approval process " + projectName[0];

    So I commented the projectName[0] to works.. =p

    Follow my codes

    privatestaticstringFormatApprovers(string[] list)

            {

               

    try


                {

                   

    if(list == null)

                       

    returnString.Empty;

                   

    StringBuilderstrbuilder = newStringBuilder(@"<my:Assignments xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD' xmlns:pc='http://schemas.microsoft.com/office/infopath/2007/PartnerControls'><my:Assignment>");

                   

    foreach(strings inlist)

                    {

                        strbuilder.AppendFormat(

    @" <my:Assignee>

                                                        <Person>

                                                        <DisplayName />

                                                        <AccountType>User</AccountType>

                                                        <AccountId>{0}</AccountId>

                                                        </Person>

                                                        </my:Assignee>"

    , s);

                    }

                    strbuilder.AppendFormat(

    @" <my:AssignmentType>Parallel</my:AssignmentType>

                                                </my:Assignment>

                                                </my:Assignments>"

    );

                   

    returnstrbuilder.ToString();

                }

               

    catch(Exceptionext)

                {

                   

    thrownewException("erro foarmt "+ list[0].ToString() + " error "+ ext.Message.ToString());

                }

            }

           

    privatevoidVerifyExitCondition(objectsender, ConditionalEventArgse)

            {

               

    try


                {

                   

    IfElseBranchActivitySender = (IfElseBranchActivity)sender;

                    Microsoft.Office.Workflow.Actions.

    OfficeTaskofficeTask = Sender.Parent.Parent.Parent asMicrosoft.Office.Workflow.Actions.OfficeTask;

                   

    // Microsoft.Office.Workflow.Actions.OfficeTask officeTask = Sender.Parent.Parent as Microsoft.Office.Workflow.Actions.OfficeTask;


                   

    if(officeTask == null)

                    {

                       

    //return;


                        e.Result =

    true;

                        approvalResult =

    true;

                    }

                   

    if(officeTask.TaskResults["Approved"] != null)

                    {

                        e.Result =

    true;

                        approvalResult =

    true;

                    }

                   

    else


                    {

                        e.Result =

    true;

                        approvalResult =

    false;

                    }

                }

               

    catch(Exceptionext)

                {

                   

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

                }

            }

           

    privatevoidIfIdeaNotApproved(objectsender, ConditionalEventArgse)

            {

               

    try


                {

                   

    //e.Result = !approvalResult;


                    e.Result = !approvalResult;

                }

               

    catch(Exceptionext)

                {

                   

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

                }

            }

    Renato Torres Project Blog - Projetizando


    Wednesday, June 20, 2012 1:46 PM

All replies

  • I forgot to send my prints.


    Renato Torres Project Blog - Projetizando

    Wednesday, June 20, 2012 1:50 PM
  • Hi guys

    Does anyone could help me?


    Renato Torres Project Blog - Projetizando

    Tuesday, June 26, 2012 1:02 PM
  • Renato,

    It's togh to tell by just looking at the image and a piece of code you provided.  Given that you say that the office task gets skipped altogether, I'm sure the problem lays in how you've set up your office task exit conditions and the code-behind that supports it.  Double check your flow, i.e. on what conditions the endTaskProcess fires and how you keep track of it in code.

    I would definitely step throug the code as well (debug), it helps a lot in workflow development.  Although, sometimes it's somewhat painful to set up to work properly, i.e debugging.

    Ilya

    Monday, July 2, 2012 8:43 PM
  • Hi Rockmus, tks for your help.

    So, after a lot of time I can debug my workflow, and for my surprise the error continues when I call a FomartApprover method.

    In this method I receive a TeamLeads array that is filled by a read group security member and this array is returning null. I have checked the group that I specified and He has 3 users.

    I could see that I can't access any other informations like ProjectName as well.

    Do you know what could be?

    Sorry about my english. I am brazilian and I am not fluent! =D

    Cheers


    Renato Torres Project Blog - Projetizando

    Tuesday, July 3, 2012 5:46 PM
  • Renato,

    No worries about the language.  The only reason I could think of (as far as your variables being null) is that they are not set properly.  For example, for ProjectName, somewhere in your workflow you would have to call readProjectProerty activity and store the return value in a global variable.  This way it will be avaialble to you throughout the whole workflow (which, I guess you do have, but maybe you are storing the value incorrectly, I can't see the properties on readProjectName).  Same for TeamLeads, check to see if your readProjectSecurityGroupMembers activity is set up correctly, double check the security GUID, etc.  Also what is updateProjectApproval for?

    Ilya

    p.s. Do you need DM workflow specialists in Brazil, because I'm ready to come help you guys out :) And see the World Cup in 2014 while I am at it.

    Friday, July 6, 2012 4:50 PM
  • And just a piece of advice: I can see that you are throwing custom excptions in your code.  Every time this piece of code hits, the workflow will be terminated and you'll have to restart it, which may not be desirable in most circumstances.  I try to catch all possible exceptions and perform actions that will not cause the workflow to hault.

    Ilya

    Friday, July 6, 2012 5:37 PM
  • Hey Rockmus,

    Thanks for your reply.

    I just put this exception to see when he is stopping. It's just a test.

    I will recreate this workflow using all the steps mentioned on the white paper. I think is some litle problem that I can't see.

    I am just studying how create and customize project workflows it's not a critical project.

    Tks again!

    PS: If you want to come to Brazil to watch the World Cup I receive you in my home, but you have to pay a beer to me... =D


    Renato Torres Project Blog - Projetizando

    Monday, July 16, 2012 7:25 PM
  • Yes, following that white paper shoud work.  That's what I did, when I just started out.  It worked for me.

    Ilya

    P.S. Buying you a few beers is not a problem at all :)  Do you have an e-mail where you can be reached?

    Wednesday, July 18, 2012 3:53 PM
  • I will try it.

    You can contact me by rptorres10@gmail.com

    Send me a email and let's watch the world cup together.. =D


    Renato Torres Project Blog - Projetizando

    Thursday, July 19, 2012 7:00 PM
  • Hi Renato

    Did you figure this out? I am kind of having the same trouble as you. All the variables (projectName, TeamLeads) are showing up as null. These are variables set by the respective (ReadProjectProperty, ReadProjectSecurityGroupMembers) workflow items. I have set the correct GUID for the TeamLead group.

    Thanks


    Maha

    Tuesday, July 31, 2012 7:37 PM
  • Hi Maha,

    I can't fix this problem.

    I am studying how create cutomized workflows and I haven't had enough time to recreate it. My case was a study case.

    As such Rockums sad, I think we are making any differnt thing from the white paper.

    Have you tried recreate this workflow?

    Cheers


    Renato Torres Project Blog - Projetizando

    Tuesday, July 31, 2012 7:43 PM
  • Hi Maha,

    I can't fix this problem.

    I am studying how create cutomized workflows and I haven't had enough time to recreate it. My case was a study case.

    As such Rockums sad, I think we are making any differnt thing from the white paper.

    Have you tried recreate this workflow?

    Cheers


    Renato Torres Project Blog - Projetizando

    Tuesday, July 31, 2012 7:43 PM
  • Retried a fresh workflow till the onTaskStartedBuildApprovers (which calls the BuildApprovers function) step as in the Hitchhiker's Guide and noticed ProjectName & TeamLeads values are null. I checked the rights and am running the workflow under System Account. Tried keeping and removing the System Admin account as part of TeamLead/Managers groups.

    Any leads to fix this issue is appreciated.


    Maha

    Wednesday, August 1, 2012 4:05 PM
  • If you want to zip up your entire solution and send it to me, I'll try to take a look at it.  i.krivulin@f5.com
    Wednesday, August 1, 2012 4:28 PM
  • Renato,

    Maha's issue was solved by binding the property values properly.  Instead of using ellipses and entering values manually, try double-clicking on the yellow "Bind" icon and pick values from the pop-up window.  This should bind your variables correctly.

    Hope it works!

    • Proposed as answer by Rockmus Wednesday, August 1, 2012 7:52 PM
    Wednesday, August 1, 2012 7:51 PM