Delete Document from Record View in UI

Hello All, 

I have a tab to view documents in a record view that the user has uploaded when the original request was created. I have a CDT-A where I store the folder id of the document which was uploaded and the document information is stored in another CDT - B(document id, folder id and request id that ties back to the original record). In the record view, we get the documents for that record from CDT-B and display it. How do we delete one or all of the documents displayed on the record view? 

Below is the code we have so far: 

a!gridField(

label: "",
showWhen: rule!APN_isNotEmpty(
local!requestDocument
),
totalCount: index(
local!requestDocument,
"totalCount",
null
),
columns: {
a!gridTextColumn(
label: "DOC NAME,
data: a!forEach(
items: index(
local!requestDocument.data,
"appianDocumentId",
null
),
expression: fn!document(
fv!item,
"name"
)
),
links: a!forEach(
items: index(
local!requestDocument.data,
"appianDocumentId",
null
),
expression: a!documentDownloadLink(
fv!item
)
)
),
a!gridTextColumn(
label: "",
data: a!forEach(
items: index(
local!requestDocument.data,
"uploadedBy",
null
),
expression: rule!APN_displayUser(
fv!item
)
)
),
a!gridTextColumn(
label: "UPLOADED ON"
field: "uploadedOn",
data: index(
local!requestDocument.data,
"uploadedOn",
null
)
)
},
value: local!pagingInfo,
saveInto: local!pagingInfo
)

 

Thanks

  • Hi bpmnewb,

    if you want to delete from record summary view,
    it can be possible thru related action, based on the selected record we have doc id, so you can create process model accordingly.

    when user want to delete the doc, then you can this prces model and delete that doc form document hierarchy.

    hope it will help you.

    Regards,
    Bhanu.
  • Hi bpmnewb,

    You can do it in different ways. For me, one of the best ways is adding a new image column displaying an "x" image to let users to click on it and delete the document using the function a!deleteDocument().

    It could be like this (just complete it with inputs you need):

    a!gridImageColumn(
      label: "Remove",
      field: "remove",
      data: a!forEach(
        local!requestDocument.data,
        a!documentImage(
          document: a!iconIndicator("REMOVE"),
          link: a!dynamicLink(
            label: "Remove",
            value: fv!index,
            saveInto: {
              a!deleteDocument( index(  index( local!requestDocument.data, "appianDocumentId", null ), fv!index ) ),
              a!save(local!requestDocument, remove(local!requestDocument, fv!index))
            }
          )
        )
      )
    )

 Discussion posts and replies are publicly visible