1

I have an Apex class in my Managed package that contains the standard methods that do most of the work in our application.

Here is a little snipped of the managed package code...

public with sharing class OrderService
{
public class OrderInfo
{
     public Id OrderID;
     public Date returnDate;
     public boolean Validated;
     public string ValidationMessage;                  
}
public static void ValidateCommitOrders(List<OrderInfo> OrderInfos)
{
    a bunch of code here
}
}

Now I am working in an Extension Org for a customer of that package and trying to write a test class that attempts to do one of those standard processes.

Here is a snippet of that test class code...

   OrderService.OrderInfo OrderInfo = new OrderService.OrderInfo();
   OrderInfo.OrderId = objOR1.Id;
   List<OrderService.OrderInfo> OrderInfos = new List<OrderService.OrderInfo>{OrderInfo};
   OrderService.ValidateCommitOrders(OrderInfos);
   System.assertequals(OrderInfo.Validated,FALSE);

And I am getting a compile error.

   Error: Compile Error: Invalid type: OrderService.OrderInfo at line 1,058 column 49

(line 1058 is the top line in the test code sample)

Is there a way to using Managed Package apex classes in an org where the package is installed?

Any assistance/direction y'all could provide would be greatly appreciated Angie

1 Answer 1

4

There are two things you are missing:

1: Global Methods

Your method needs to be declared as global so that it can be accessed from outside of the managed package. NB: Once a method has been marked as global and the package has been uploaded, you will not be able to remove that method or change its signature

2: Namespaces

You need to add the namespace of your managed package to reference components from it. e.g. abc.OrderService

1
  • 1
    As an additional clarification, you can check the namespace prefix for your managed packages here: Setup -> Installed Packages -> Your Package Name -> Namespace Prefix field.
    – hlopetz
    Commented Sep 30, 2016 at 16:58

You must log in to answer this question.

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