SetValue is updating only once after submitting the request (InfoPath 2007) RRS feed

  • Question

  • I am working on leave request infopath form.First user creating the leave request  and mail sent to manager for approval.once manager approve the request the FormStatus is not updating from "Approval" to "Accepted".


    Default value of FormStatus is "Request".FormStatus is changed its value once when they requested From Request to Approval,when mangaer updated the request FormStatus is not updating from

    Approval to Accepted.I am not getting the error ,I can see value is changed in debugging but once the form runs to browser its notupdatin.


    here is code.

             public void FormEvents_Submit(object sender, SubmitEventArgs e)


                    XPathNavigator Main = MainDataSource.CreateNavigator();

                    XPathNavigator FormStatus = Main.SelectSingleNode("/my:myFields/my:FormStatus", NamespaceManager);

                     if (FormStatus.Value == "Request")
                        FormStatus.SetValue("Approval"); //Works fine first time
          EmailSubmitConnection emailConn =
                        (EmailSubmitConnection)DataConnections["Request Email"];
                        emailConn.EmailAttachmentType = EmailAttachmentType.None;


                        //send mail and submit the data to sharepoint library

                        DataConnection spConn = DataConnections["SharePoint Library Submit"];
                    else if (FormStatus.Value == "Approval")

                        //Remove the "nil" attribute.
                        if (FormStatus.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))

                        //Set the value of the myDate field.
                        FormStatus.SetValue("Accepted");//Not updatin the second time...

                              //update the data to sharepoint library                   


                    // If the submit operation is successful, set
                    e.CancelableArgs.Cancel = false;
                    // Write your code here.

     Any heps ..

    Friday, March 25, 2011 2:20 PM


  • Looks like you are setting the status to "Manager" after you do the "Approval" so the else if condition won't be executed. Remove the "FormStatus.SetValue("Manager");" line and see what happens...


    • Marked as answer by Peng Lei Friday, April 1, 2011 8:11 AM
    Wednesday, March 30, 2011 6:27 PM