File Preview Modal in Lightning Web Component | Salesforce ☁️⚡️

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024
  • In this video I will share the code to preview files in a Modal in Lightning Web Component.
    There are three component in this example -
    1. PreviewFileThumbnails - The parent component to upload the file.
    2. PreviewFileThumbnailCard - Child component to display image preview in a thumbnail gallery view.
    3. PreviewFileModal - Child component to display selected thumbnail file in a new modal popup for preview.
    #Files #PreviewModal #salesforce
    Join me on Instagram : / iamkapilbatra
    Blog : www.salesforce...
    Website : www.salesforce...​​
    LinkedIn : / salesforcebolt
    Twitter : / salesforcebolt​​
    Facebook : / iamsalesforcebolt

ความคิดเห็น • 39

  • @ganeshrajput2491
    @ganeshrajput2491 2 ปีที่แล้ว +2

    Thanks for vido and code this save lot more time while developing

  • @nitishbhosale2231
    @nitishbhosale2231 2 ปีที่แล้ว +1

    Thanks for uploading

  • @praveenndu9889
    @praveenndu9889 2 ปีที่แล้ว +1

    Good one mate!

  • @user-lm6xs1dm4r
    @user-lm6xs1dm4r 10 หลายเดือนก่อน +2

    Where can i get these code for reference

    • @SalesforceBolt
      @SalesforceBolt  10 หลายเดือนก่อน +1

      For each video you can find code snippets in the description
      www.salesforcebolt.com/2021/11/file-preview-modal-in-lightning-web-component.html

  • @nirupasinha8227
    @nirupasinha8227 ปีที่แล้ว

    Hi @Salesforce bolt
    I need to display or preview CMS pdf word and Excel file to the community portal page.
    Could you please make a video on that or please help me for this.

  • @anilpoudel5974
    @anilpoudel5974 2 ปีที่แล้ว +1

    Sir suppose I have AL3 file in my desktop and I need to convert that format and read using third party API how I will upload file in that API and retrieve that file in particular format without the use of any object just normally passing desktop file.

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      Hi there, I would suggest you to convert that file in blob and then pass the blob data to the API.

    • @anilpoudel5974
      @anilpoudel5974 2 ปีที่แล้ว

      How we send file as argument

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      @@anilpoudel5974 you may save that file in your org and then use VersionData from ContentVersion

  • @shareandcare9083
    @shareandcare9083 ปีที่แล้ว +1

    Hi @salesforce Bolt,
    This is amazing
    Recently I have also created the LWC component which supports both Attachments and Content Versions.
    We have checkbox option there so if user wants to download specific download attachments they can download it in the ZIP file.
    But major thing i have faced that is the heap size issue.
    So it would be great if you review my code. Please let me know where i can share my code with you.
    or help me if we can remove heap size issue to download multiple files and attachments at single click in form of ZIp
    Thank you

    • @SalesforceBolt
      @SalesforceBolt  ปีที่แล้ว

      Hi there, I will try to include this heap size solution in my upcoming video.

    • @shareandcare9083
      @shareandcare9083 ปีที่แล้ว

      @@SalesforceBolt Thank you so much.. waiting 😊

    • @pavanswarnkar0303
      @pavanswarnkar0303 ปีที่แล้ว

      ​@@shareandcare9083Could you share the approach of showing or preview file using only Attachment (not content version)?

  • @Playheroes1
    @Playheroes1 11 หลายเดือนก่อน +2

    Can you please share the code?

    • @SalesforceBolt
      @SalesforceBolt  11 หลายเดือนก่อน

      Hi there,
      for each video code snippet has attached in the description of it as blog post.
      www.salesforcebolt.com/2021/11/file-preview-modal-in-lightning-web-component.html

  • @bobbypepetrueno3431
    @bobbypepetrueno3431 2 ปีที่แล้ว

    Hi @Salesforce Bolt, thanks for your explanation! I want to do this preview modal for the pdf file that I have in a VF Page, using a lightning button. Do you have any suggestion ?

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว +1

      You can have that VF page url in src

    • @bobbypepetrueno3431
      @bobbypepetrueno3431 2 ปีที่แล้ว

      @@SalesforceBolt Thank you very much for the suggestion Kapil, in fact I did it just in that way.

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      @@bobbypepetrueno3431 awesome!

  • @Unknown-wi3mr
    @Unknown-wi3mr 2 ปีที่แล้ว

    Thanks for solution, but not able to preview docx and xls file with this code

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      Try to put a debug and see if it's getting inside below if block
      if (this.file.Extension === "xls") {
      return "doctype:excel";
      }

  • @veluphp5916
    @veluphp5916 ปีที่แล้ว

    can we show preview of csv, exce, doc, xls also?

    • @SalesforceBolt
      @SalesforceBolt  ปีที่แล้ว

      This is just for image, pdf and doc file. For other types you can display an icon instead of preview and redirect user on click of it.

  • @nikitadavande5387
    @nikitadavande5387 2 ปีที่แล้ว

    Hello @salesforce Bolt
    can you please tell me , how I can used this component on community site in salesforce .. because when i have added this component on community site ..that time file preview is not possible ...only we can uploads file.

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      Have you tried it in your scratch org or developer org first ? Was that working there ?
      Just want to understand if it's working outside the community sites.

    • @nikitadavande5387
      @nikitadavande5387 2 ปีที่แล้ว

      @@SalesforceBolt yes i have tried in my developer org ,it is working to specific record page

    • @elinemorais1565
      @elinemorais1565 2 ปีที่แล้ว

      @@nikitadavande5387 Have you succeed in using it on community site?

  • @Shabloop
    @Shabloop 2 ปีที่แล้ว

    not working for me. trying to use this with carousel. correct url and all

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      Do you see any error there?

    • @Shabloop
      @Shabloop 2 ปีที่แล้ว

      @@SalesforceBolt Hi thanks for the reply. was able to resolve the issue. Now im using your popup modal. I cant seem to change the size of the modal. when trying to add style on it. it changes position instead of changing size

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      @@Shabloop is it a quick action modal?

    • @Shabloop
      @Shabloop 2 ปีที่แล้ว +1

      @@SalesforceBolt Thank you very much for replying to my comments. I have already resolved the issue when i was watching your wiring video. seems that i had an issue with my wiring method when iterating the data.

    • @SalesforceBolt
      @SalesforceBolt  2 ปีที่แล้ว

      @@Shabloop great, glad you figured it out!

  • @sunidhipandey2973
    @sunidhipandey2973 ปีที่แล้ว +1

    Hi, can you explain how are you creating these image urls: /sfc/servlet.shepherd/version ?

    • @SalesforceBolt
      @SalesforceBolt  ปีที่แล้ว

      Hi, this is the root URL of images in a Salesforce Org. It will be same in your org as well!