Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The goal of this gist is to describe how to query an object within a SFDC Managed Package, with a user who is not licensed for access to the managed project. There are two components, an apex class containing a custom REST endpoint, and a VisualForce Page where we hit the SF AJAX Proxy enroute to the SF REST API.
global with sharing class ApexRESTExample {
global static List<NAMESPACE__ManagedPackageObject__c> getTasks() {
List<NAMESPACE__ManagedPackageObject__c> test = [SELECT Id, Name from NAMESPACE__ManagedPackageObject__c];
return test;
<apex:page sidebar="false" showHeader="false" >
<script src=""></script>
<script type="text/javascript">
var sessionId = '{!$Api.Session_ID}';
cache: false,
url: '/services/proxy',
beforeSend: function(xhr) {
xhr.setRequestHeader('SalesforceProxy-Endpoint', '');
xhr.setRequestHeader('Authorization', 'OAuth ' + sessionId);
success: function(data,status,xhr){
error: function(xhr,status,errorThrown){
$('body').html(errorThrown+': '+JSON.stringify(xhr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.