0

I have a Canvas App inside a standard page layout on the Opportunity layout. I'd like to expose some information to the external Canvas App (some field values), but it seems like the lifecycle handler isn't doing the trick.

Here's the source:

  public void onRender(Canvas.RenderContext renderContext)
  {
    Canvas.ApplicationContext app = renderContext.getApplicationContext();
    Canvas.EnvironmentContext env = renderContext.getEnvironmentContext();

    Set<String> fields = new Set<String>{'Id', 'Name'};
    env.addEntityFields(fields);
  }

Is it because it can only expose information if it is used inside a Visualforce page (apex:canvasPage) ?

EDIT

Based on this part in the documentation, it should technically work when included as a Page Layout item since it is inside an object context:

The list of object fields for which Salesforce will return Record context data if the canvas app appears on an object page. One way a canvas app can appear on an object page is if the canvas app appears on a Visualforce page through the use of the component and that Visualforce page is associated with an object

EDIT 2

Considering this link (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_canvas_EnvironmentContext_addEntityField.htm), does it only work in <apex:canvasApp>? Do I have to create a dummy Visualforce page with a StandardController and add the canvasApp to get this data in?

0

It seems like Salesforce addressed this issue in Winter 16, even if it was not documented in their Release Notes.

It is now possible to expose field values in the signed_request related to a record when the Canvas App is embed in a standard Page Layout, just like it was possible before using <apex:canvasApp>.

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.