Skip to main content
Hi,

Could you please tell how I can set a few xml fields inside one server event? I have code as below:
K2.Synchronous = True

Dim xmldata As String = K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value

Dim StrTime As String=DateString & " " & TimeString
K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(xmldata,"my:RASPricingForm/my:DataPostedByDate",StrTime)

K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(xmldata,"my:RASPricingForm/my:SalesManager","aPerson")

It only populate the filed of salesManager. However, if I move swap the last two lines of code, it only poulate the DataPostedByDate to the current date time.

Could you please help with this? Thank you very much.

Regards
Flo
Hi,

I was given the solution, hope to share with you. It was because the xmldata was overwritten. The code below works:

K2.Synchronous = True

Dim xmldata As String = K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value

Dim StrTime As String=DateString & " " & TimeString
xmldata = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(xmldata,"my:RASPricingForm/my:DataPostedByDate",StrTime)

xmldata = SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(xmldata,"my:RASPricingForm/my:SalesManager","aPerson")

K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value = xmldata

Cheers
Flo

Reply