Error : Formula Expression is required on the action attributes.

Visualforce page name :- Facebook_integration_homepage

<apex:page controller="facebookintegrationhomepage"  action="{!getmyprofiledata}" showHeader="true" sidebar="true">

URL:- https://c.ap2.visual.force.com/apex/Facebook_integration_homepage?access_token=EAAMCvxSocvQBADM9xGamO5Fod9ZCbs6r7HqxeJ41DPZCmy039N4RYKZB7javOQMX559QfM6JtGGXfWE2LhW61vd8EaUXJ3ITIp3BY2ikmnyYDMXGNJ33t3WIeBk84oFcZACZBzYAHbhrLCCnkWV20fIoZBAg58LmHSU1pOjAZCovQZDZD

Controller 1) facebookintegrationhomepage

public String getmyprofiledata()

    Pagereference p = ApexPages.currentPage(); 
    code = p.getParameters().get('access_token');
     if ((!(string.isBlank(code))))
            ownprofile =facebook_API.getownprofile(code);

            // error
        return ownprofile;

Controller 2) :- facebook_API

public static String getownprofile(String token)
        Http http =new Http();
        HttpRequest req =new HttpRequest();
        HttpResponse res = http.send(req);             
         return res.getBody();

  • Modify your action method to return type of PageReference. – TSmith Nov 9 '16 at 13:05
  • thanks @TSmith I had tried that too but i got the issue of "An internal server Error" – Innodel Salesforce Nov 9 '16 at 13:08
  • An unhandled exception on the Salesforce platform. Salesforce either encountered a condition which caused an error that needs to be corrected or the error is valid and Salesforce needs to show a more useful error message. Can you try remove the call to facebook_API class this may be causing you an issue. – TSmith Nov 9 '16 at 13:14
  • @TSmith Thank you ! – Innodel Salesforce Nov 9 '16 at 13:32

Action method should have return type of PageReference. Something like:

public PageReference getmyprofiledata()
{ ....... }

You mentioned an internal server error in the above comments. This is an unhandled exception on the Salesforce platform. By gradually commenting out code you will identify what is triggering this exception.

Begin by commenting the call to facebook_API class.

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.