Find your content:

Search form

You are here

Using the apex:page action attribute in embedded layouts

 
Share

Anyone aware of why the initializeActivity method would not be called (when embedded in a layout)?

calling javascript throws a cross domain error. I really dont want to have to make a callout to make this work. Im trying to do a dml operation on initializing the controller.

Visualforce:

  <apex:page standardController="Contact" 
    extensions="ActivityExtension" action="initializeActivity">
  </apex:page>

Apex:

public ActivityExtension(ApexPages.StandardController stdController){
   id = stdController.getId();
   sObjectName = stdController.getRecord().getSObjectType().getDescribe().getName();
}
public PageReference initializeActivity(){
   read(sObjectName,id);
   return null;
}

Attribution to: ebt

Possible Suggestion/Solution #1

Oi I feel like an idiot. Missing the required syntax in the action attribute:

this

<apex:page standardController="Contact" 
     extensions="ActivityExtension" action="initializeActivity">
</apex:page>

should be

<apex:page standardController="Contact" 
     extensions="ActivityExtension" action="{!initializeActivity}">
</apex:page>

nothing to see here...

=)


Attribution to: ebt
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/642

My Block Status

My Block Content