<?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>Document viewer Field Help</title><link>https://community.appian.com/discussions/f/new-to-appian/26010/document-viewer-field-help</link><description>How can we add something like an &amp;quot;Upload&amp;quot; or &amp;quot;Preview Document&amp;quot; button on the form that submits (typically without validation), and simply chains back to itself - this will give the user the impression they have not left the form, but turns the document</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101899?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 16:05:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:208c068e-16fa-499c-93a3-0f062704332a</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;Thanks Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101888?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 14:21:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:999a6b65-11cc-4416-9466-f224c4ec4cd6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;That looks pretty similar - mind sharing exactly what the important change was?&lt;/p&gt;
&lt;p&gt;Never mind, I did a np++ diff, i see it now.&amp;nbsp; Good catch, I didn&amp;#39;t notice originally that the &amp;#39;Preview&amp;#39; button was not set for &amp;#39;Submit&amp;#39;.&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1664202132688v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101869?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 11:30:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5ed6624a-1abb-4f83-a51f-e0e949f232d2</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;Your welcome&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101868?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 11:30:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5951e10e-530e-49a6-a01a-89e1f0097243</guid><dc:creator>FrankT</dc:creator><description>&lt;p&gt;Thank you it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101807?ContentTypeID=1</link><pubDate>Sun, 25 Sep 2022 03:59:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ed407903-2dc4-4f49-bea2-76d88afae6a7</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;Hi Frank I have made some changes in your code please check I have mentioned the comments.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!document,
  /* there are more graceful ways to check for doc existance */
  local!documentExists: not(tostring(ri!document) = &amp;quot;[Document:]&amp;quot;),
  a!formLayout(
    label: &amp;quot;Document Upload / Preview&amp;quot;,
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!fileUploadField(
                          value: local!document,
                          saveInto: local!document,
                          maxSelections: 1,
                          target: cons!AA_DOCUMENTS_FOLDER_POINTER/*set the target for the documents*/
                        )
                      ),
                      a!sideBySideItem(
                        item: a!buttonArrayLayout(
                          buttons: {
                            a!buttonWidget(
                              label: &amp;quot;Preview Document&amp;quot;,
                              value: &amp;quot;PREVIEW&amp;quot;,
                              submit: true(),/*mark submit as true*/
                              saveInto: {
                                ri!navigation,
                                a!save(ri!document, local!document)
                              }
                            )
                          }
                        )
                      )
                    }
                  )
                }
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!documentViewerField(
                    showWhen: local!documentExists,
                    document: ri!document
                  ),
                  a!richTextDisplayField(
                    showWhen: not(local!documentExists),
                    value: {
                      a!richTextItem(
                        text: &amp;quot;You must click Preview on the left for the document to be viewed&amp;quot;,
                        style: &amp;quot;EMPHASIS&amp;quot;
                      )
                    }
                  )
                }
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Submit&amp;quot;,
          validate: true,
          submit: true,
          value: &amp;quot;SUBMIT&amp;quot;,
          saveInto: {
            ri!navigation,
            a!save(ri!document, local!document)
          }
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Cancel&amp;quot;,
          validate: false,
          submit: true,
          value: &amp;quot;CANCEL&amp;quot;,
          saveInto: ri!navigation
        )
      }
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101796?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 22:29:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:51145dc6-4b85-49b8-8f6e-10f18f1faeee</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What sequence of events is bringing you to that error? &amp;nbsp;Are you using the form (and getting the error) in a process model setup? &amp;nbsp;Or are you trying to do it in the interface editor?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101795?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 21:27:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fb108e07-3fcd-4972-a265-96042aa4f01c</guid><dc:creator>FrankT</dc:creator><description>&lt;p&gt;I replaced back as the original, but I still get the same error.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!document,
  /* there are more graceful ways to check for doc existance */
  local!documentExists: not(tostring(ri!document)= &amp;quot;[Document:]&amp;quot;
  ),
  a!formLayout(
    label: &amp;quot;Document Upload / Preview&amp;quot;,
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!fileUploadField(
                          value: local!document,
                          saveInto: local!document,
                          maxSelections: 1
                        )
                      ),
                      a!sideBySideItem(
                        item: a!buttonArrayLayout(
                          buttons: {
                            a!buttonWidget(
                              label: &amp;quot;Preview Document&amp;quot;,
                              value: &amp;quot;PREVIEW&amp;quot;,
                              saveInto: {
                                ri!navigation,
                                a!save(ri!document,local!document)
                              }
                            )
                          }
                        )
                      )
                    }
                  )
                }
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!documentViewerField(
                    showWhen: local!documentExists,
                    document: ri!document
                  ),
                  a!richTextDisplayField(
                    showWhen: not(local!documentExists),
                    value: {
                      a!richTextItem(
                        text: &amp;quot;You must click Preview on the left for the document to be viewed&amp;quot;,
                        style: &amp;quot;EMPHASIS&amp;quot;
                      )
                    }
                  )
                }
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Submit&amp;quot;,
          validate: true,
          submit: true,
          value: &amp;quot;SUBMIT&amp;quot;,
          saveInto: {
            ri!navigation,
            a!save(ri!document,local!document)
          }
        )
      },
      secondaryButtons:  {
        a!buttonWidget(
          label: &amp;quot;Cancel&amp;quot;,
          validate: false,
          submit: true,
          value: &amp;quot;CANCEL&amp;quot;,
          saveInto: ri!navigation
        )
      }
    )
  )
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101794?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 21:07:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3547cc9-beb2-4cf4-8007-077a20ca4ee2</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Why did you change the example code Chris gave you for &lt;em&gt;&lt;strong&gt;local!documentExists&lt;/strong&gt;&lt;/em&gt;&lt;span style="text-decoration:underline;"&gt;&lt;/span&gt;?&amp;nbsp; The code you have in your expression here wouldn&amp;#39;t do anything.&amp;nbsp; His original one would check whether the ri!document is empty, successfully (though honestly i&amp;#39;d just use a null checker on the rule input).&lt;/p&gt;
&lt;p&gt;Correct:&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1663967136682v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Your version:&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1663967192804v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The problem here is if your &amp;quot;local!documentExists&amp;quot; evaluates to TRUE when ri!document is actually empty, the preview field will attempt to show anyway, but with an invalid document, causing the error you posted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101793?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 20:32:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0e4ff9a4-8dcf-48c0-b37e-2a0a816abdca</guid><dc:creator>FrankT</dc:creator><description>&lt;p&gt;I&amp;#39;m getting the error &amp;quot;&lt;strong class="StrongText---richtext_strong StrongText---inMessageLayout StrongText---error"&gt;Could not display interface. Please check definition and inputs.&lt;/strong&gt; Interface Definition: Expression evaluation error at function a!documentViewerField [line 51]: Document Does Not Exist or has been Deleted&amp;quot;&lt;/p&gt;
&lt;p&gt;Can someone please tell me what I&amp;#39;m doing wrong please.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!document,
  /* there are more graceful ways to check for doc existance */
  local!documentExists: not(tostring(ri!document)= false()
  ),
  a!formLayout(
    label: &amp;quot;Document Upload / Preview&amp;quot;,
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!fileUploadField(
                          value: local!document,
                          saveInto: local!document,
                          maxSelections: 1
                        )
                      ),
                      a!sideBySideItem(
                        item: a!buttonArrayLayout(
                          buttons: {
                            a!buttonWidget(
                              label: &amp;quot;Preview Document&amp;quot;,
                              value: &amp;quot;PREVIEW&amp;quot;,
                              saveInto: {
                                ri!navigation,
                                a!save(ri!document,local!document)
                              }
                            )
                          }
                        )
                      )
                    }
                  )
                }
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!documentViewerField(
                    showWhen: local!documentExists,
                    document: ri!document
                  ),
                  a!richTextDisplayField(
                    showWhen: not(local!documentExists),
                    value: {
                      a!richTextItem(
                        text: &amp;quot;You must click Preview on the left for the document to be viewed&amp;quot;,
                        style: &amp;quot;EMPHASIS&amp;quot;
                      )
                    }
                  )
                }
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Submit&amp;quot;,
          validate: true,
          submit: true,
          value: &amp;quot;SUBMIT&amp;quot;,
          saveInto: {
            ri!navigation,
            a!save(ri!document,local!document)
          }
        )
      },
      secondaryButtons:  {
        a!buttonWidget(
          label: &amp;quot;Cancel&amp;quot;,
          validate: false,
          submit: true,
          value: &amp;quot;CANCEL&amp;quot;,
          saveInto: ri!navigation
        )
      }
    )
  )
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101791?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 19:08:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7aa9caf1-7216-43c9-9098-2e5f7da058ac</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I just did a double-take since they both have the same display name, but then I noticed one has a profile picture and the other one doesn&amp;#39;t (and upon checking, they end up having different usernames).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I assume it might be a legit thing (like someone transitioning from a personal account to a company-backed account), though with the amount of spambots in here lately, it always makes me second-guess myself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101788?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 17:44:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a26a63ee-04b9-4fa5-847a-cb9fbc1332ee</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;..I didn&amp;#39;t note the 2 separate accounts...&amp;nbsp;&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f937.svg" title="Shrug"&gt;&amp;#x1f937;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101786?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 17:33:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:63de1014-d6d8-4bfb-b7fb-52ed7d12dacd</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="2401" url="~/discussions/f/new-to-appian/26010/document-viewer-field-help/101784#101784"]this is a continuation of the &lt;a href="/discussions/f/new-to-appian/26009/how-to-get-document-viewer-field-working"&gt;other thread on the topic&lt;/a&gt;[/quote]
&lt;p&gt;and... copied &lt;a href="/discussions/f/new-to-appian/26009/how-to-get-document-viewer-field-working/101778#101778"&gt;nearly word-for-word&lt;/a&gt; from your comment -- and... posted by 2 separate accounts ... *scratches head*&amp;nbsp; &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f615.svg" title="Confused"&gt;&amp;#x1f615;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Document viewer Field Help</title><link>https://community.appian.com/thread/101784?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 17:02:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3b39775c-8567-498e-a981-329d637f9c92</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;This is pretty much as straightforward as adding a!buttonArrayLayout() on the interface that submits the form, then the form will chain back to itself - typically with a decision node to determine if they are asking for a preview, or submitting/canceling the form to move the process:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1663952339362v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;A quick and dirty sample interface would be something like below with 2 inputs for &lt;em&gt;document&lt;/em&gt; (document), and &lt;em&gt;navigation&lt;/em&gt; (text):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!document,
  /* there are more graceful ways to check for doc existance */
  local!documentExists: not(tostring(ri!document)=&amp;quot;[Document:]&amp;quot;),
  a!formLayout(
    label: &amp;quot;Document Upload / Preview&amp;quot;,
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!fileUploadField(
                          value: local!document,
                          saveInto: local!document,
                          maxSelections: 1
                        )
                      ),
                      a!sideBySideItem(
                        item: a!buttonArrayLayout(
                          buttons: {
                            a!buttonWidget(
                              label: &amp;quot;Preview Document&amp;quot;,
                              value: &amp;quot;PREVIEW&amp;quot;,
                              saveInto: {
                                ri!navigation,
                                a!save(ri!document,local!document)
                              }
                            )
                          }
                        )
                      )
                    }
                  )
                }
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!boxLayout(
                label: &amp;quot;Select Document&amp;quot;,
                style: &amp;quot;ACCENT&amp;quot;,
                contents: {
                  a!documentViewerField(
                    showWhen: local!documentExists,
                    document: ri!document
                  ),
                  a!richTextDisplayField(
                    showWhen: not(local!documentExists),
                    value: {
                      a!richTextItem(
                        text: &amp;quot;You must click Preview on the left for the document to be viewed&amp;quot;,
                        style: &amp;quot;EMPHASIS&amp;quot;
                      )
                    }
                  )
                }
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Submit&amp;quot;,
          validate: true,
          submit: true,
          value: &amp;quot;SUBMIT&amp;quot;,
          saveInto: {
            ri!navigation,
            a!save(ri!document,local!document)
          }
        )
      },
      secondaryButtons:  {
        a!buttonWidget(
          label: &amp;quot;Cancel&amp;quot;,
          validate: false,
          submit: true,
          value: &amp;quot;CANCEL&amp;quot;,
          saveInto: ri!navigation
        )
      }
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Just to note, this is a continuation of the &lt;a href="/discussions/f/new-to-appian/26009/how-to-get-document-viewer-field-working"&gt;other thread on the topic&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>