How to configure default document

Hi,

my requirement is to set the default document so i have taken value from my database which i have already uploaded and i used those values into the linkfield with  a!documentDownloadLink but still i unable to see the document can you please help me where i went wrong, Below is my code.

a!localVariables(
local!text:"Please refer these document and send your reply soon",
local!newGrid:'type!{urn:com:appian:types:SHA}SHA_receivedDocuments'(),
local!emailSubject:"Sending mail regarding Property Documents",
local!document:40915,
local!docName:"Dummy Document",
{

a!sectionLayout(
          label:"",
          contents: {
            a!richTextDisplayField(
              labelPosition:"COLLAPSED",
              value:{
                a!richTextIcon(
                  icon:"file-text",
                  color:"ACCENT",
                  size:"LARGE" 
                ),
                a!richTextItem(
                  text:"Document",
                  color:"SECONDARY",
                  size:"LARGE",
                  style:"STRONG"
                )
              }
            )
          },
          divider:"BELOW"
        ),
a!gridLayout(
           headerCells: {

            a!gridLayoutHeaderCell(label:"Upload Document",align:"CENTER"),
            a!gridLayoutHeaderCell(label:"Document Type",align: "CENTER"),
            a!gridLayoutHeaderCell(label:"Document Description ",align: "CENTER"),
            a!gridLayoutHeaderCell(label:"Action")
          },
          columnConfigs: {

            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "ICON" )
          },
          rows:{
            a!forEach(
              items: ri!documents,
              expression: a!gridRowLayout(
                contents: {
                 if(
                   rule!FCO_hasValue(fv!item.receiveDocId),
                  a!fileUploadField(
                    label: "File Upload",
                    labelPosition: "ABOVE",
                    target:cons!SHA_FOLDER,
                    maxSelections:1,
                    value:fv!item.receiveDocId,
                     
                      
                    saveInto: fv!item.receiveDocId,
                    required: true(),
                 
                  ),
                  a!linkField(
                    links: {
                      a!documentDownloadLink(
                        label: local!docName,
                        document:todocument(local!document)
                      )
                    }
                  ),
                  ),
                  a!dropdownField(
                    label: "Document Type",
                    labelPosition: "ADJACENT",
                    placeholder: "Select the type of document",
                    choiceLabels:cons!SHA_TYPESOFDOCUMENTS,
                    choiceValues:cons!SHA_TYPESOFDOCUMENTS,
                    value:fv!item.docType,
                    saveInto:fv!item.docType,

                  ),

                  a!textField(
                    label:"Document Description",
                    placeholder:"Enter document description",
                    value:fv!item.docDescription,
                    saveInto:fv!item.docDescription,


                  ),
                  a!richTextDisplayField(
                    label: "Rich Text",
                    labelPosition: "COLLAPSED",
                    value: {a!richTextIcon(
                      icon: "trash",
                      link: a!dynamicLink(
                        saveInto: a!save(ri!documents,remove(ri!documents,fv!index)
                        )
                      ),
                      size: "STANDARD",  
                      color:"NEGATIVE",

                    )},


                  )

                }

              )
            ),


          },
          selectionValue: ri!documents,
          selectionSaveInto: ri!documents,
          addRowLink: a!dynamicLink(
            label: "Upload file",
            value:true(),
            saveInto:{ a!save
            (ri!documents,append(ri!documents,{local!newGrid}))
            } ,


          ),


        ),

   }   
   )

  Discussion posts and replies are publicly visible

Parents Reply
  • thank you peter for your reply, my application is property management,I am sending a mail to the  buyer with the signed documents (which is default document, default body ),sending mail is related action, upon clicking this action the inteface will be open with all these default docs and body if they want they can uploaad the document and change the body while sending the email

Children
  • But how will they upload any documents?? When you add a new row it will display the default document and there will be no way to get it to show the file upload. I'd suggest rethinking your grid - you might be able to do something like provide a checkbox to "use default document" that would then hide the file upload field, but as it stands it will always show the link and never show the file upload (because the value would always be null when you add a new row).