<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Unable to detach file from a!fileUploadField</title><link>https://community.appian.com/discussions/f/user-interface/31190/unable-to-detach-file-from-a-fileuploadfield</link><description>Hello, 
 I have a problem with a form interface where users are supposed to be able to drop a file with a a!fileUploadField, but if the user tries to detach the file before submitting form or to detach it by updating the record, I have this error : 
</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Unable to detach file from a!fileUploadField</title><link>https://community.appian.com/thread/124575?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 16:55:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:411a3f9f-eeb0-42b0-aaf6-8fad9ffe4a8b</guid><dc:creator>SGT FLANAGAN Michael</dc:creator><description>&lt;p&gt;Yes I&amp;#39;m developping my first app and I have no dev background.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll retry with your code as an example, thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to detach file from a!fileUploadField</title><link>https://community.appian.com/thread/124573?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 16:04:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dac108f9-d612-4a9e-a32d-78ace3f3c2dc</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Are you new to Appian? The way how Appian data structures work, will take a while to get used to. Yes, this is considered a one-to-many which makes it a list.&lt;/p&gt;
&lt;p&gt;I turned your code into a working example.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!case: a!map(
    id: 42,
    documents: null
  ),
  a!fileUploadField(
    label: &amp;quot;Pi&amp;#232;ce jointe&amp;quot;,
    labelPosition: &amp;quot;ABOVE&amp;quot;,
    placeholder: &amp;quot;Placez la pi&amp;#232;ce jointe ici&amp;quot;,
    target: tofolder(123),
    maxSelections: 3,
    value: index(local!case.documents, &amp;quot;documentId&amp;quot;, null),
    saveInto: a!save(
      target: local!case.documents,
      value: a!forEach(
        items: save!value,
        expression: a!map(
          id: null,
          documentId: fv!item
        )
      )
    ),
    validations: {if(
      or(fv!files.size &amp;gt; 2000000), 
      &amp;quot;Le fichier ne peut pas faire plus de 2MB. Merci de retirer : &amp;quot; &amp;amp; 
      index(fv!files, &amp;quot;name&amp;quot;, where(fv!files.size &amp;gt; 2000000), {}), 
      &amp;quot;&amp;quot;
    )}
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to detach file from a!fileUploadField</title><link>https://community.appian.com/thread/124572?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 16:01:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:160bb85d-7f6f-4951-876a-8f15914155e3</guid><dc:creator>SGT FLANAGAN Michael</dc:creator><description>&lt;p&gt;Thanks for the answer,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why is it defined as a list of record ? I&amp;#39;m just targeting a normal field of a normal record but through a relationship, I didn&amp;#39;t define it as a list or an array at any moment, why is the rule input considered as a list ? Is it because the relationship is one-to-many ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to detach file from a!fileUploadField</title><link>https://community.appian.com/thread/124571?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 15:56:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fef88b7-f7b0-4525-945b-3911a62c499b</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;That&amp;#39;s no surprise. You try to write a list with zero items into a single field in a related record.&lt;/p&gt;
&lt;p&gt;I did never try this specific situation myself, but when I try to store document data to a list of records, I do that directly in the saveInto. What I mean is, to run a foreach on save!value&amp;nbsp;creating a record structure for each file, and then store that to the rule input.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>