0

I am working to improve Apex code coverage and trying to create a placeholder Conga_Template__c record. The test will not call conga but will check for a valid conga template record in the database. We do Not use seeAllData in any of our tests so that is not an option.

Have tried referencing the object with and without the namespace prefix but it is not recognized. My thought is that an instance of conga_template__c object cannot be created with code due to restrictions in the managed package but not sure how to confirm this!

  • Can you include what you tried and the specific error message that ensued? – David Reed Oct 31 '18 at 17:49
  • As long as you have access to the managed package object, you can access it within your test class (or any other class or trigger). I am not sure if there's a restriction that can be placed by the provider of not allowing any access to the object. You may like to verify if the object here has necessary permissions on the profile. – Jayant Das Oct 31 '18 at 18:17
  • When I try to create an instance of the object in my testData class I get invalid type errors when trying to save the test class updates. – debraSF Oct 31 '18 at 18:28
  • We will need to see the code here. As an example I provided some details and can see this works just fine. – Jayant Das Oct 31 '18 at 18:32
1

I am working to improve Apex code coverage and trying to create a placeholder Conga_Template__c record

Have tried referencing the object with and without the namespace prefix but it is not recognized.

You must be missing something while referring the object, as there is no restriction in accessing the object in test class (or apex or trigger) as long as you have the right permissions.

As a quick test, I verified and was able to access the object that you are trying to create in your test class without any issues.

@isTest
private static void myTestMethod() {
    APXTConga4__Conga_Template__c a = new APXTConga4__Conga_Template__c();
}

You may like to verify:

  1. If you have right permissions
  2. If you have any typo in the name of the object while referring it in the test class

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.