[SalesForce] Controller not found in Inline visualforce page

I am getting this error in the inline vf page:

Controller not found for 'CloudFilesController'

while no such error comes when I open the vf page directly without using it as inline page.

VF page:

<apex:page showHeader="false" sidebar="false" standardController="Lead" extensions="CloudFilesController">
  <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


  <script>
       var loadFiles = function() {
            Visualforce.remoting.Manager.invokeAction(
                '{!$RemoteAction.CloudFilesController.getFiles}',
                function(result, event){
                    if (event.status) {
                        console.log(result);
                    } else {
                        console.log('some error occurred');
                    }
                });
        } 
  </script>
</apex:page>

CloudFilesController:

public with sharing class CloudFilesController {

    public CloudFilesController(ApexPages.StandardController controller) {

    }

    @RemoteAction
    public static List<CloudFile__c> getFiles() {
       return null;
    }

}

Best Answer

I just needed to make my method and class global in the controller. Thanks to this answer Need help understanding why my Javascript remoting doesn't work on a standard Page Layout

Related Topic