Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Approval tasks is not creating

$
0
0

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



Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>