2

We are planning to use a Canvas App in one of the AppExchange app. Canvas App will have different subdomains URLs and a single sign-on.

As the CanvasApp URL can't be dynamically set with different subdomains (abc.stackexchange.com, xyz.stackexchange.com, etc.), we will need to give Canvas Creation as a part of the configuration document or we need to create a connected app (Canvas + SSO) programmatically by using Metadata API on subscriber org.

Also, we wanted to embed the CanvasApp within a Lightning Component to pass dynamic parameters and publish/subscribe events from the Lightning component.

 <force:canvasApp developerName="DyanamicallyOrManuallyCreatedCanvasApp" height="1000px" width="1200px" parameters="{!v.parameters}"  />

Question: As the CanvasApp will not be part of the package, we can't package the lightning component because the Lightning Component has the reference of developerName. Is it possible to set the force:canvasApp 's developerName dynamically through a property, which can be filled from a custom setting? By that only CanvasApp will not be part of the package. But Lightning Component will be part of package and a managed component.

2

One elegant way to do this would be to use a design resource that admins can fill in when they drag and drop the component.

An example of how to create a design resource is mentioned here.

 <aura:attribute name="developerName" type="String" default="" access="global" />
 <force:canvasApp developerName="{!v.developerName}" height="1000px" width="1200px" parameters="{!v.parameters}"  />

And a Design resource

<design:component label="Company XYZ Connected App">
  <design:attribute name="developerName" label="Developer Name" />
</design:component>

The above is for Aura Component since Canvas is supported as Aura Component only

Another way would be to use an apex class looking at Custom Metadata or Custom Settings that the Aura or your LWC Component can invoke and set the Aura attribute.

1
  • Thanks a lot Mohit. This answer is really helpful.
    – Ashish
    Feb 17 at 19:43

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.