Through a form in an interface, I upload files or images and it is stored in my db as a number (I guess it's the ID, image bellow). The images are stored in a folder in my KC
This is the expression of my fileupload
a!fileUploadField( label: "Cedula: PARTE FRONTAL", labelPosition: "ABOVE", target: cons!CWA_OEC_DOCUMENTS_FOLDER_POINTER, fileNames: ri!CWA_OECClient.coeccedula&"_"&"c1_frontCI", maxSelections: 1, value: ri!CWA_OECClient.coecfile1, saveInto: ri!CWA_OECClient.coecfile1, required: true, validations: if( or(upper(fv!files.extension) = { "PDF","PNG","JPG" }), null, "Please upload a valid image type: png or jpg" ), uploadMethods: { "CAMERA", "CHOOSE_PHOTO", "CHOOSE_FILE" }, buttonDisplay: "LABEL_AND_ICON", buttonStyle: "PRIMARY", buttonSize: "LARGE" ),
I deleted all the files and images of my KC, and now i cant see the other data of my db in the summary view.
When I go to the summary of a record to see the other data I get this error
Discussion posts and replies are publicly visible
I think that error because you deleted the images in KC.
As you deleted all the files and images from the KC it will show this error. To get rid of this, you have to create new instances or in the DB delete the data for file1,2 and 3 columns so that it can't look for these documentId's in Appian.
To handle this error you can apply a check to whether the document ID is valid or not.
a!localVariables( local!document: 46,/*ID for any document */ local!contentData: if( isnull(local!document), null, getcontentobjectdetailsbyid(local!document) ), if( isnull(local!document), false(), and( not( exact( local!contentData, "No object with this ID has been found" ) ), find("Type: Document", local!contentData) ) ) )
That works though as a design note, it's a lot of manual work to do (and remember) if you end up with lots of places in your system where you need to do something similar. I usually encapsulate checks like these in an easy-to-remember / easy-to-find expression rule that takes a doc / docId and returns a simple boolean output. For instance the following, which you could name "rule!GLBL_docExists()" or similar:
and( a!isNotNullOrEmpty(ri!doc), tointeger(ri!doc) > 0, isobjectexists("Document", ri!doc) )
Note: this uses the Check Object Existence plug-in, though it would only require a minor tweak to use the Content Tools rule (as seen above) instead in a similar implementation.