Hello,
I am trying to add a document link to an interface. I found the a!documentDownloadLink function and it tells me to create a constant to point to my documents but I am a bit lost.
This is an interface where a supervisor will approve or deny a request so the document link in the form should be attached to the specific request. What do I need to do in the cosntant to point specifically to that value?
The value is store in my recordType as an integer and it is added to the record through an attachment component in a record action.
any help is appreciated
Discussion posts and replies are publicly visible
I don't see that constant is required for a!documentDownloadLink()If document id stored in DB and document id exist in appian simply use document id from record. use below code to understand more.
{ a!linkField( label: "Download document", labelPosition: "ABOVE", links: { a!documentDownloadLink( label: document( documentId:{}, /*Add your document id here from record.*/ property: "name" ), document: {} /*Add your document id here record.*/ ) } ) }
You can create a constant of "Document" type:
There is a document id and it is store on the DB but the document shown needs to match the current information that is being reviewed. T
he idea is that someone will have a review request and all the pertinent information will pop up, including the documents attached to that specific request.
Bit confused.Correct me here: You just need to provide the document link for the document whose ID is coming from the database?
Yes I need to provide a document link from the DB but that value should match the form being evaluated at the moment. am sorry if I am not explaining myself correctly.
gabrield295009 said: that value should match the form being evaluated at the moment
it's unclear what you're actually saying here.
Yup sorry, long day. I have a record action where a user submits a form that can include attachaments. That form should be later evaluated by a supervisor.
I want the information from the record action to be displayed in the supervisor interface, including a link to the attachments. I can display all other information but I do not know how to dislpay a link to the attachments.
The attachments are store to my documents folder through a file upload input and attached to my record type through a field called "documentacion" of Number(integer) type.
how can i display the link?
What is wrong with Shubham's original answer? This should be correct.
Shubham Aware said:If document id stored in DB and document id exist in appian simply use document id from record.
Yeah, you are right I was not doing it properly. Thanks! Thank you Shubham Aware
One nitpick / advice here - I never recommend anyone use a!linkField() at all for any reason, now that we have a!richTextDisplayField(). The latter makes it more easy and flexible to control the link, what it displays, and when to display it.
{ a!richTextDisplayField( label: "Download document", value: { a!richTextItem( text: { "Click Here to Download ", /* whatever label you want */ a!richTextIcon(icon: "file-export") }, link: a!documentDownloadLink( /*label: "" */ /* "label" component is not used in this context - the rich text item's text is sufficient */ document: 123, /* Your document id here */ showWhen: true() /* add conditionality here to turn the link "on" or "off" as needed */ ) ) } ) }
Plus, we get rich text formatting options including icons, links that can be on individual words in the middle of a longer string, etc.