1

I have added external object in an unlocked package. This object is getting call from apex classes. I have added the datasources also. But getting errors like below:

1. Invalid type: Schema.ExternalObject__x 2. Invalid type: ExternalObject__x

Please help me to resolve these errors.

  • Could you provide more info like source code, line at which error occurs etc.? – arut Apr 23 at 12:01
  • Thanks for your comments but the error message is not showing any line number. I have a method in class: public Method(ExternalObjName__x activity) {} – Ananga Apr 23 at 12:21
  • Have you implemented in the try-catch block or placed some system.debug statements in this method to narrow down to the possible line of code causing the error? – arut Apr 23 at 12:51
  • My issue is not related to code,, its working perfectly. I want to add that class in an unlocked package.The issue is related to how can I add external objects in a SFDX unlocked package. – Ananga Apr 23 at 13:17
  • We get this issue too intermittently trying to deploy code with external object references in apex and it's unclear why (in sandboxes). Sometimes deploying new code will unblock the error. Like anything developer related in salesforce, external objects are very poor technology that offer no debugging capabilities – Andy Ray Jun 24 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.