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

 Discussion posts and replies are publicly visible