0

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

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 Aug 30 '20 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.