I have an infopath form .On the change event of To Field i am updating the value of another field called Shift. For that i have written following code.
public void To_Changed(object sender, XmlEventArgs e)
{
// Write your code here to change the main data source.
///my:myFields/my:RequestDetails/my:IndividualRequest/my:To
// Write your code here.
// Write your code here to change the main data source.
///my:myFields/my:RequestDetails/my:IndividualRequest/my:To
try
{
XPathNavigator xmlDoc = this.MainDataSource.CreateNavigator();
XPathNavigator xTo = xmlDoc.SelectSingleNode("my:myFields/my:RequestDetails/my:IndividualRequest/my:To", this.NamespaceManager);
XPathNavigator xShift = xmlDoc.SelectSingleNode("/my:myFields/my:RequestDetails/my:IndividualRequest/my:Shifts", this.NamespaceManager);
xShift.SetValue("6");
}
catch (Exception ex)
{
Log.WriteLog(ex);
}
}
I have published the form and uploaded the form as contenttype. however when i change the To value in the infpath form, Shift Field value not updating.
I have solved this issue using Rules in infopath.