Hi,
I want to use to Infopath forms in one process. I think this should be possible. The problem is that I want to display fields and values form Infopath form1 in the Infopath form2. Is this possible in the process by using events?
Jochen
Hi,
I want to use to Infopath forms in one process. I think this should be possible. The problem is that I want to display fields and values form Infopath form1 in the Infopath form2. Is this possible in the process by using events?
Jochen
Can you describe more of the actual process you are trying to accomplish.
I have written server events events to get some data from the xml fields. but I don't know how to set the xml fields of the second infopath form.
Here is a little Code exemple I have done yet:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(K2.ProcessInstance.XmlFields["test"].Value.ToString());
XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsMgr.AddNamespace("my", xmlDoc.DocumentElement.GetNamespaceOfPrefix("my"));
string approver2 = xmlDoc.SelectSingleNode("//my:myFields/my:approver2", nsMgr).InnerText;
Probably with this statement I will be able to set a XML value
xmlDoc.SelectSingleNode("//my:myFields/my:approver2", nsMgr).Value = "text"
or is this too simple?
Little bit too simple, but almost there. You need to put the updated xml back into your xml field, like this:
K2. ProcessInstance.XmlFields["test"].value = xmlDoc.InnerXml
xmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(K2.ProcessInstance.XmlFields["test"].Value.ToString());
XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsMgr.AddNamespace("my", xmlDoc.DocumentElement.GetNamespaceOfPrefix("my"));
xmlDoc.SelectSingleNode("//my:myFields/my:text2", nsMgr).Value = "text";
K2.ProcessInstance.XmlFields["test"].Value = xmlDoc.InnerXml;
When I write this code I get the following error message
"Cannot set a value on node type 'Element'."
any idea?
thx
Yes! You have to make a little change:
xmlDoc.SelectSingleNode("//my:myFields/my:text2", nsMgr).Value = "text";
should be
xmlDoc.SelectSingleNode("//my:myFields/my:text2", nsMgr).InnerText = "text";
yes. your are rigth.
Thank you!
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.