We have a managed package app which makes dynamic queries where the customer can set which fields to query on an object.

The customer has enabled in her org the service called 'Field Service Lightning', so the WorkOrder standard object is enabled.

The customer created a lookup on our packaged bt_stripe__Transaction__c object to the WorkOrder object, and set the app to dynamically query that field.

When the query is made, we are getting the following error:

Error in query: Field bt_stripe__Transaction__c.WorkOrder__c is inaccessible in this context

My guess is that this is happening because our packaged app doesn't have the access to the WorkOrder object, so querying the lookup fails.

Is there any way to query these fields from the namespace-context?

  • How does your dynamic query looks like, ideally it should not be a problem. – Raul Oct 17 '17 at 12:03
  • please share the SOQL query, and tell us how do you run it. – Itai Shmida Oct 18 '17 at 5:08

Check the API version of your class that makes the dynamic query. The Work Order object was introduced in API v36.0, so if your class is v35.0 or earlier, it will not be aware of the existence of the Work Order object.



There are can be couple of things that can cause this.

  • The running user doesn't have access to the WorkOrder__c field. Fix would be giving them access field / object
  • If WorkOrder__c is a formula field, it might be referencing some fields that user might not have access.

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.