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();
//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 helps ..