Didn't do decent troubleshooting but...
First try with simpler code like a hardcoded display name and login.
Second, try the Update() method of the Process Instance after you've set the XML field.
Hope this helps,
Ockert
That's it...
The update() method did the job...
I have used this code and modified it a bit to get my own schema i.e.
- <xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"> <Company CompanyName="Accountants On Call" CompanyID="9" Selected="false" />
<Company CompanyName="Afgri Operations Ltd" CompanyID="43" Selected="false" />
<Company CompanyName="BAD" CompanyID="22" Selected="false" />
</xs:schema>
My problem is when I read it back with the following code :
Connexion = new SourceCode.K2ROM.Connection();
Connexion.Open(ConfigurationSettings.AppSettings["PlanServer"]);
K2Instance = Connexion.OpenProcessInstance(int.Parse(Request.QueryString["sn"].Split(',')[1]));
XmlNodeReader reader = null;
XmlDocument doc = new XmlDocument();
doc.LoadXml(K2Instance.XmlFields["IntCompany"].Schema);
XmlNodeList NodeList = null;
NodeList = doc.DocumentElement.GetElementsByTagName("Company");
foreach(XmlNode CompanyNode in NodeList)
{
reader = new XmlNodeReader(CompanyNode);
reader.Read();
ListItem newItem = new ListItem(reader.GetAttribute("CompanyName"),reader.GetAttribute("CompanyID"));
if (reader.GetAttribute("Selected") == "true")
newItem.Selected = true;
else
newItem.Selected = false;
}
reader.Close();
I do not get any data back can anyone help here please. I am new to using XML so please forgive me if I am totally lost here.
You must use the value property to bring back the data. Have a look at the example:
'Put user code to initialize the page here
Dim cn As New K2ROM.Connection
Dim WLItem As K2ROM.WorklistItem
Dim WList As K2ROM.Worklist
Dim sn As String
Dim ProcessInstanceID As String
Dim redirectURL As String
Dim PrevComments As String
Try
If Not IsPostBack Then
sn = Request.QueryString("sn").ToString
cn.Open(sn.Split(",")(0))
WList = cn.OpenWorklist("ASP")
ProcessInstanceID = sn.Split(",")(1)
For Each WLItem In WList
Dim WListProcessID As String = WLItem.ProcessInstance.ID.ToString
If WListProcessID = ProcessInstanceID Then
WLItem.Open()
With WLItem
lblTopic.Text = "Topic to discuss: " & .ProcessInstance.DataFields("Topic").Value
PrevComments = .ProcessInstance.XmlFields("PrevComments").Value
Dim DS As New DataSet
Dim FS As FileStream
If PrevComments <> "" Then
Dim XmlDoc As New System.Xml.XmlDocument
XmlDoc.LoadXml(PrevComments)
XmlDoc.Save(Server.MapPath("K2.xml"))
FS = New FileStream(Server.MapPath("K2.xml"), FileMode.Open, FileAccess.Read)
Dim Reader As StreamReader
Reader = New StreamReader(FS)
DS.ReadXml(Reader)
FS.Close()
Dim View As DataView
View = New DataView(DS.Tables(0))
DGComments.DataSource = View
DGComments.DataBind()
End If
End With
Exit For
End If
Next
cn.Close()
End If
Catch ex As Exception
redirectURL = ConfigurationSettings.AppSettings("WebRoot") & "Error.aspx?Error=" & ex.Message
Response.Redirect(redirectURL)
End Try