0

Which is the best way to download a ContentDocument by the button's onclick event? (Available also in community)

1 Answer 1

1

You can do the trick using navigation:

In HTML

<lightning-button label="Click me" onclick={download}></lightning-button>

In Javascript

download() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/sfc/servlet.shepherd/document/download/0692w000000MmSyAAK?operationContext=S1'
            }
        })
    }
1
  • Does this work for community users also?
    – devforce
    Commented Aug 30, 2020 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .