Skip to main content
added 108 characters in body
Source Link
sanket kumar
  • 15.6k
  • 2
  • 29
  • 60

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

Another way of accessing the download url is using contentdistribution object

sample example can be found here:- https://gist.github.com/lukethacoder/818d4dba3f7fb00ea861a76fe85fc1a3

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

Another way of accessing the download url is using contentdistribution object

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

Another way of accessing the download url is using contentdistribution object

sample example can be found here:- https://gist.github.com/lukethacoder/818d4dba3f7fb00ea861a76fe85fc1a3

added 240 characters in body
Source Link
sanket kumar
  • 15.6k
  • 2
  • 29
  • 60

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

Another way of accessing the download url is using contentdistribution object

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

Another way of accessing the download url is using contentdistribution object

added 352 characters in body
Source Link
sanket kumar
  • 15.6k
  • 2
  • 29
  • 60

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

You have run a loop on your result and navigate to download url using window.open like this:-

telechargerConv({ recordId : currentRow }).then(result => {
    result.forEach(element => {
        window.open(element.DownloadUrl, '_blank');
    });
})

This will open a new tab, download the file and close it automatically for each of the item in your result.


Update

the download url should look like this:-

https://db0000000dzqemau-dev-ed.develop.lightning.force.com/sfc/servlet.shepherd/version/download/068B000000BU4wNIAT?operationContext=S1

i.e window.location.origin +'/sfc/servlet.shepherd/version/download/'+ version id+'?operationContext=S1'

you need to make sure you have download url as above format

Again Update

if you are in community, then your url should be like this:-

String fileDownloadUrl = URL.getSalesforceBaseUrl().toExternalForm()  + '/sfc/servlet.shepherd/document/download/' + contentDocument Id + '?operationContext=S1';

the only difference i can see in your code is you are missing '?operationContext=S1' in url

added 392 characters in body
Source Link
sanket kumar
  • 15.6k
  • 2
  • 29
  • 60
Loading
Source Link
sanket kumar
  • 15.6k
  • 2
  • 29
  • 60
Loading