6

I'm creating a component to export some data to a .csv file, the creation of the file works great in Apex but when I get the Id back and try to navigate to it it fails, I've tried with

     const navEvt = $A.get("e.force:navigateToSObject");
           navEvt.setParams({
                  "recordId": id,

                });
           navEvt.fire();

And

    $A.get('e.lightning:openFiles').fire({
          recordsId : [id],
          selectedRecordId : id
     });

But I can't seem to display the file (I've also tried with the ContentDocumentId)

  • Are you getting an error message? – Doug Ayers Feb 17 '17 at 2:37
3

Perhaps try navigateToUrl event: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToURL.htm

var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
  "url": '/' + fileId
});
urlEvent.fire();

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.