I have an issue on production. There is an interface which does not open up and throws an error on the screen as below:
Interface Definition: Expression evaluation error at function a!forEach [line 22]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'document' [line 24]: Document Does Not Exist or has been Deleted
There are two documents attached to the record and one of them seems to be not present. However, when I tried to search for these documents in the entire environment in the Appian Objects, only one of them is found and the other one is absent. Whenever the attachments are deleted from the interface, the attachment record is marked in the Database as D- "Deleted" and also the interface will always show only the A- "Active" attachment records on the screen.
Now, when I tried to get the object details and print the value in a paragraphfield as below:
a!paragraphField( value:a!forEach(items:local!documentsUploaded.data.documentId, expression: getcontentobjectdetailsbyid(fv!item)) ) There are results returned for both the documents as below: Content Object [Name: Test_Document2, UUID: _a-0000e48d-6f96-8000-9ba6-011c48011c48_1598857, Parent: Temporary Documents Knowledge Center, Parent Id: 7, Type: Document, Created by: test_user1, Created on: 2020-06-16 20:46:41.0, Last updated by: test_user1, Last updated on: 2020-06-16 20:46:42.0, Latest version: 1, State: Invactive Published, Internal file name: N/A]; Content Object [Name: Test_Document2, UUID: _a-0000e48d-6f96-8000-9ba6-011c48011c48_1598874, Parent: Request Upload Files, Parent Id: 36756, Type: Document, Created by: test_user1, Created on: 2020-06-16 20:51:39.0, Last updated by: test_user1, Last updated on: 2020-06-16 20:51:40.0, Latest version: 1, State: Active Published, Internal file name: accdocs1/32029/10154090.pdf] I am a little confused with the state parameter though as above. And when tried to use document() function, it says the first one in the list above does not exist or has been deleted. Also, tried using the function: finddocumentsbyname() to find it in complete directory or root KC as mentioned above "Temporary Documents Knowledge Center", no document found! The overall thing looks very strange since there is no trace of attachments to be deleted. Any pointers regarding this would be appreciated! Thanks in advance!
Discussion posts and replies are publicly visible
The error message is very clear. You're trying to access a Document object in Appian that doesn't exist anymore. If you're keeping the Id of the Document in the database and have marked this as logically deleted (as per your statement:
then you need to filter out any such rows when you query from the database into Appian so you don't even attempt to reference the document in your Appian interface.
Or have I missed something here?
No, the document does'nt seem to be deleted by the user as per the process history. However, our business would be checking about it with the user directly on the same. Also, the Appian code is working fine regarding the deletion logic, the database seems to be updated fine in case of deletion.
© 2021 Appian. All rights reserved.