Skip to main content
I'm trying to clear some values in the process XML using the SetXMLValue method of the K2Utilities.XMLFieldMod object, but it doesn't seem to work.

Here is my statement:
SourceCode.K2Utilities.XMLFieldMod.SetXMLValue(K2.ProcessInstance.XmlFields.Item("K2InfoPathSchema").Value,"my:myFields/my:Reviewers/my:Delegations/my:Delegated", String.Empty)

I'm doing a Console.Writeline of that element using the GetXMLValue method of the same object both before and after the above statement, and it shows the same value before and after.

Any help would be appreciated.
Hi,

just an idea.
Create a new process data field from type string and leave it empty as its default value.
Then use a Data Manipulation event and select the process data field as you source data and the InfoPath xml field as the destination. Select copy from the dropdown box. After the wizard finished make a right click on the Data Manipulation event, on event item switch to use code and select edit code. With this code it should definetly work and you can may be use it to find out where your error comes from.

Hope it helps, let me know if you need some further information.
FYI - I have solved my problem.

After adding the new destination users from the delegations node I clear it by resetting it back to the original state:


K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value =
SourceCode.K2Utilities.XMLFieldMod.SetXMLValue _
(K2.ProcessInstance.XmlFields.Item ("K2InfoPathSchema").Value, _
"my:myFields/my:Reviewers/my:Delegations", _
"<my:Delegated/>" _
"<my:DelegateFromID/>" _
"<my:DelegateFromName/>" _
"<my:DelegateFromComments/>" _
"<my:DelegationsGroup>" _
" <my:DelegateToID/>" _
" <my:DelegateToName/>" _
"</my:DelegationsGroup>")

Reply