Skip to main content
Participating Frequently
Oct 16, 2023 5:14 PM UTC
Question

a!documentDownloadLink

i link: a!documentDownloadLink(document:
fv!item.appianDocId
), 

 used the above two lines to  download  a document but it does not download  , it open a tab with a message error : 

{
"error": "APNX-1-0000-000",
"message": "Invalid Content ID",
"title": "An Error Has Occurred"
}

    9 replies

    harshm4411
    Participating Frequently
    Oct 16, 2023 6:16 PM UTC

    Hey, the format for utilizing the document download link is as follows:


    a!linkField(
    label: "Link",
    labelPosition: "ABOVE",
    links: {
    a!documentDownloadLink(
    label: "Document Link",
    document: 8552    /* document id */
    )
    }
    )

    stefanhelzle0001
    Brainy
    Oct 16, 2023 6:33 PM UTC

    Is that value in appianDocId a valid document id?

    Participating Frequently
    Oct 16, 2023 6:37 PM UTC

    Yes it seems like it's saving the appianDocId in the database correctly 

    stefanhelzle0001
    Brainy
    Oct 16, 2023 6:39 PM UTC

    You just shared this minimal code snippet. I cannot help you much without more context.

    Did you check the actual values in that data you seem to iterate on?

    annap0005
    Participating Frequently
    Nov 7, 2023 12:31 PM UTC

    look like that appianDocId is not exist or deleted.

    Try to search that is in objects with type UUID or ID. Im sure you will not find that.

    Known Participant
    Nov 8, 2023 12:55 PM UTC

    It seems the object you are trying to download does not exists in appian. So before passing the documentID to a!documentDownloadLink() function better to check the exitance of document in Appian using following functions:

    isobjectexists returns true if object exists in Appian.

    isobjectexists(
    "Document",
    /*documentID*/
    )    

    getcontentobjectdetailsbyid will return all the content of the object.

    getcontentobjectdetailsbyid(
    /*documentID*/
    )

     

    Participating Frequently
    Nov 9, 2023 5:00 AM UTC

    a!gridColumn(
    label: "Download Doc",
    value: a!richTextDisplayField(
    value: a!richTextIcon(
    icon: "download",
    link: a!documentDownloadLink(
    label: document(
    fv!row['recordType!recordTypeName.fields.documentId'],
    "name"
    ),
    document: todocument(
    fv!row['recordType!recordTypeName.fields.documentId']
    )
    )
    ),

    ),
    align: "CENTER",
    width: "1X"
    )

    Hi , try to check with the above code