Skip to main content
Question

Box UIElements SDK in a Salesforce LWC Ligthtning Web Component ?

  • May 23, 2025
  • 8 replies
  • 13 views

Forum|alt.badge.img

Hi,

Could the Salesforce team at Box make a sample component available, or a reference implementation, for an LWC component to display a ContentPreview of a Bow document in a Salesforce LWC component ?

 

There are several issues with Javascript packaging, as well as the Salesforce Locker and Lightning Web Security models which make it not straightforward.

Other samples for FileUpload, Comments etc. would also be great.

 

#Salesforce #LWC #UIElements #ContentPreview #Preview

8 replies

Forum|alt.badge.img

Hello, 

Any recommendations actually go on our Pulse site! 

Thanks, 

Alex, Box Developer Advocate


Forum|alt.badge.img

Hi Alex, thanks for the link.

However, I'm not asking for a Box feature, just a sample or example of the integration of Box UI Elements in a Salesforce LWC Lightning Web Component. I'm looking for a working example, which I have found nowhere.

I hope you can help.

Thanks, Rupert


Forum|alt.badge.img

Hi Rupert!

 

You definitely hit the nail on the head when you described Locker and Web Security making the implementation not very straight forward. Using a Salesforce Canvas App is the only production-ready solution that I have personally worked with. The downsides of Canvas is that its only available in Lightning Aura and it requires that you host your UI Elements app off-platform. Here are some examples using that approach:

Going down the LWC route and deploying UI Elements as static resources runs into the following known issues in which Lightning Locker will block:

  • Content Preview under the covers actually uses 3rd-party libs for different types of preview. In particular, pdf.js uses things like eval that Locker will block.
  • Content Upload users javascript workers to help with multiput/chunked uploads for larger files.  Locker will throw an exception when this happens.
  • Content Explorer and Content Picker contain one or both of the above UI Elements

The new Light DOM Beta could be a potential, but I have not had a chance to test this thoroughly:

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/create_light_dom

Thanks,

Kyle

Box Partner Architect


Forum|alt.badge.img

Thanks for the info, Kyle.

I saw your repos on Github : I will try them.

I think you should definitely get in touch with Salesforce to help you get something working; maybe Greg Whitworth can help (Director of Product Manager on LWC's applications and backend services) : https://twitter.com/gregwhitworth

PDFTron have managed to get their viewer to work on LWC; I think it would be a very good value for the market to get Box UI Elements working there also. I hope you can help with this..

Thanks for your help, Rupert


Forum|alt.badge.img

PS : I have got PDFTron to work on Salesforce, to read Box-hosted docs in an LWC component.

So you can understand how frustated I am not to be able to do this (yet) with Box UI Elements !


Forum|alt.badge.img

Thanks for the insight on PDFTron! I was aware that they had a Salesforce integration, but did not know is was an LWC. I'll funnel this information back to our Product Management teams and see if its possible to get something in the backlog. 


Forum|alt.badge.img

👍


Forum|alt.badge.img

Hi 13261339188, I just wanted to point out I created a couple of issues on those Github repos regarding getting the Box UI Elements working in Salesforce.

I hope you can take a look at them.