2

I am using the REST describe endpoint to present users with a list of all fields available to them on the Lead object, and then later attempting to use fields they have selected in a custom Apex endpoint I made.

This error is occurring on a customers installation of my package so I have limited knowledge of how their salesforce is configured.

So first I describe the Lead object and field Custom__c shows up. I can then make the following query and everything works fine:

"select Custom__c from Lead"

and that returns me leads and this custom field, but when my custom apex endpoint attempts to request that field I get the following error:

System.QueryException: No such column 'Custom__c' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

Which is the same error that you get if the field isnt visible to the user, but it clearly is because it is being returned by describe. What is going on? does Apex not have the same permissions as the REST API? Is there a way I can configure my permissions so I can reproduce this error and handle it?

4
  • Sounds like a silly question, but are you positive you are logging into the same org?
    – greenstork
    Commented Dec 4, 2014 at 21:20
  • yes I am, I am using the same library with the same credentials to access both the REST API and the custom Apex endpoints I have created
    – user8246
    Commented Dec 4, 2014 at 21:22
  • i've seen a similar problem but with standard fields where the describe was done with Vx but the apex ran as Vx-n and the standardField was added by sfdc at Vx
    – cropredy
    Commented Dec 5, 2014 at 0:29
  • @user8246 did you ever find out what was going on here?
    – Phil B
    Commented Jan 3, 2018 at 21:43

1 Answer 1

0

Are both running as the same user? Or without sharing? It sounds like two different profiles that have different field-level security settings.

1
  • yes, the same user, im using a library to access both the REST API and custom Apex endpoints with the same credentials
    – user8246
    Commented Dec 5, 2014 at 1:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .