Invocable Apex in Managed Package Not Returning Values

We have an Apex class in our managed package declared as global but it doesn’t seem to be returning anything to our Flow. Used the class prior to packaging it and it worked fine (then it was Public though).

Class is just trying to use the Apex Limits class and return the getQueries value.

global Class getApexLimits{

    global List<Integer> limitslist;

    @InvocableMethod(label='Reads Apex Limits' description='Invocable class to get Apex Query and DML limits')

    global static list<Integer> limitList(list<Integer> apexlimits){
        List<Integer> limitslist = new List<Integer>();
        for(Integer limitval: apexlimits){
            limitval = Limits.getQueries();
        return limitslist;


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1


all “managed packages” that are posted on the AppExchange don’t count
against your system limits

(from Everything you need to know about the NEW AppExchange) if your managed package meets that criteria then the Limits.getQueries() will only count queries that are run inside the managed package. So it will return zero if all the queries in the current transaction are from outside the managed package. (But should return a non-zero value if other @InvocableMethod within the manged package are called in the flow.) That is the issue may be related to the separation of governor limits by managed package namespace rather than the public/global change.

By the way, the description “Invocable class to get Apex Query and DML limits” doesn’t seem valid: the method returns multiple copies of the Limits.getQueries() limit depending on the length of the apexlimits list. (Presumably you are passing in a list of length of at least 1?)

Method 2

Would it be possible to package the flow as an XML and include it as a static resource? Then the managed package could ‘install’ the flow(s) as part of its initialization. I have not done or tried this, but wonder if that’s an option.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x