kylefernandadams / box-canvas-app

Box UI Elements integrated with Salesforce Lightning components and Salesforce CanvasApp
MIT License
2 stars 0 forks source link

Content Picker Is Incomplete #3

Open divisionparzero opened 2 years ago

divisionparzero commented 2 years ago

I and about 4 other developers at my org tried to get this picker to work using the instructions here, on the heroku app github instructions and the Box UI help files. There's no event we are able to pick up to continue doing stuff with the picker.

There's a Salesforce thing about subscribing to a custom event(https://developer.salesforce.com/docs/atlas.en-us.platform_connect.meta/platform_connect/canvas_app_event_subscribe_code_example.htm). There's nothing in the lightning component to account for this and the canvasapp is enclosed in an iframe (actually double iframes for some Salesforce-only-knows reason). Just something Salesforce does that can't be fixed. Anyway, as far as my understanding, event listeners can't hear past an iframe so Salesforce has this subscription to an event to overcome that. I'm not able to test this theory because I need more information to complete the subscription and don't know where to find it (e.g. the json file and the other settings in the code linked below). If we're correct, this should fix the problem and would need to be added to your source code for others to get it to work.

https://developer.salesforce.com/docs/atlas.en-us.platform_connect.meta/platform_connect/canvas_app_event_subscribe_code_example.htm

This is still just a theory. But we put a lot of hours into trying to get information on the codepen on the Box UI page for ContentPicker to work to no avail, so there's still something missing.

RupertBarrow commented 2 years ago

pub/sub works with iframes. Have a look at how PDFTron WebViewer.js does this : https://www.pdftron.com/blog/webviewer/add-pdf-viewer-editor-to-salesforce-as-lwc/#communicating-with-corecontrols-from-lightning-web-component