3

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;
}
6

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...

=)

  • 1
    Mark the question as answered then :) – Boris Bachovski Aug 20 '12 at 6:36
  • 1
    SE makes you wait two days before you can, well, you know. – ebt Aug 20 '12 at 6:39

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.