How to save multiline of text column with xml content


Badge +3

Hello,

I have a repetating section with two text box and multiline of text . Saving the following result in multiple line of text column (plain text)

<RepeaterData><Version /><Items><Item><cmtAuthor type="System.String">Vijay</cmtAuthor><cmtDate type="System.String">&amp;#160;3/8/2018&amp;#160;1:49 PM</cmtDate><CommentsInfo type="System.String">test</CommentsInfo></Item></Items></RepeaterData>

I wanted to save this data in another's list multiline of text using call web service action 

<Batch OnError="Continue">

<Method ID="1" Cmd="New">

<Field Name="Title">{ItemProperty:Title}</Field>
<Field Name="Comments" ><RepeaterData><Version /><Items><Item><cmtAuthor type="System.String">Vijay</cmtAuthor><cmtDate type="System.String">&amp;#160;3/8/2018&amp;#160;1:49 PM</cmtDate><CommentsInfo type="System.String">test</CommentsInfo></Item></Items></RepeaterData></Field>

</Method>

</Batch>

I am not getting any error after workflow finish the task, however i am unable to see the data in another list. Can someone help me here?


7 replies

Userlevel 5
Badge +14

I guess you have to XML encode source data so that it looks like

<Field Name="Comments" >&gt;RepeaterData&lt;&gt;Version /&lt;&gt;Items&lt;  ...‍  ...‍‍

 

Badge +3

Thank you i encoded the data it works till RepeaterData as shown below

<RepeaterData><Version /><Items><Item><cmtAuthor type="System.String">Vijay</cmtAuthor><cmtDate type="System.String">&amp;#160;3/8/2018&amp;#160;1:49 PM</cmtDate><CommentsInfo type="System.String">test</CommentsInfo></Item></Items></RepeaterData

&lt;RepeaterData&gt;&lt;Version /&gt;&lt;Items&gt;&lt;Item&gt;&lt;cmtAuthor type=&quot;System.String&quot;&gt;i:0#.w|pncrndpl89164&lt;/cmtAuthor&gt;&lt;cmtDate type=&quot;System.String&quot;&gt;&amp;amp;#160;3/8/2018&amp;amp;#160;1:49 PM&lt;/cmtDate&gt;&lt;CommentsInfo type=&quot;System.String&quot;&gt;test&lt;/CommentsInfo&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/RepeaterData 

if i add "&gr;"  at the end SharePoint is not taking . Please suggest

Userlevel 6
Badge +15

I think you'll have to use RegEx to replace the &quot; and all the other bits in there, to clean it up.

Userlevel 5
Badge +14

I've tried with your data and following request worked for me

note I've added a XML preamble to your repeater data

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <m:UpdateListItems>
      <m:listName>testlist</m:listName>
      <m:updates>
        <Batch OnError="Continue">
          <Method ID="1" Cmd="New">
            <Field Name="Title">{ItemProperty:Title}</Field>
            <Field Name="Comments" >&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;RepeaterData&gt;&lt;Version /&gt;&lt;Items&gt;&lt;Item&gt;&lt;cmtAuthor type=&quot;System.String&quot;&gt;Vijay&lt;/cmtAuthor&gt;&lt;cmtDate type=&quot;System.String&quot;&gt;&amp;amp;#160;3/8/2018&amp;amp;#160;1:49 PM&lt;/cmtDate&gt;&lt;CommentsInfo type=&quot;System.String&quot;&gt;test&lt;/CommentsInfo&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/RepeaterData&gt;</Field>
          </Method>
        </Batch>
      </m:updates>
    </m:UpdateListItems>
  </soap:Body>
</soap:Envelope>

Badge +3

Thank you

Userlevel 5
Badge +14

‌, did it work for you?

if so please mark the question answered

Badge +3

Thanks for the reply. Encoding did not work for me. I used web request action to call rest api, it worked for me

Reply