SetValue is updating only once after submitting the request - InfoPath Dev
in

InfoPath Dev

SetValue is updating only once after submitting the request

Last post 03-25-2011 05:23 AM by BMARU. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-25-2011 05:23 AM

    • BMARU
    • Not Ranked
    • Joined on 03-25-2011
    • Posts 24

    SetValue is updating only once after submitting the request

    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)
            {
                    CreateID();

                   CalculateDaysRequested();

                    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;
                        emailConn.Execute();

                       
                        FormStatus.SetValue("Manager");

                        //send mail and submit the data to sharepoint library

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

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

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

                              //update the data to sharepoint library                   
                      

                        FormStatus.SetValue("Accepted");
                    }

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

     

    Any heps ..

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.