0

SOSL running fine on lower instances with no namespace getting failed in manage package.Although the SOSL EXECUTE returns rows but final output always remains 0. Working fine on unmanage.

searchQuery = 'FIND \'' + searchString + '\' IN ALL FIELDS RETURNING customobject__c( a__c,b__c';
                    searchQuery += ' where Status__c=: status  and Category__c=:searchType order by Category__c ASC ';
                    searchQuery += ' limit 2000 )';
                    system.debug(searchQuery);
                    List<List<customobject__c>> fnlOp = search.query(searchQuery);
                    system.debug('O/P coming empty : '+fnlOp);
                    newList = (List<customobject__c>)searchConLead[0];
                    totalCount=newList.size();

Debug logs:

String status ='Online'; 
           |VARIABLE_ASSIGNMENT|[]|searchType|"Security"
           SOSL_EXECUTE_BEGIN|[]|FIND 'credit/debit ' IN ALL FIELDS RETURNING customobject__c(a__c,b__c  where PublishStatus__c=: status 
   and Category__c=:searchType order by Category__c ASC  limit 2000 )
           |SOSL_EXECUTE_END|[]|Rows:2
       SYSTEM_METHOD_ENTRY|[]|System.debug(ANY)
       |USER_DEBUG|[]|DEBUG|O/P coming empty : (())
       |[]|totalCount|0
  • Did you check all labels and field-level permissions to see if they were packaged correctly? – amanda fouts Oct 16 '19 at 3:31
  • Yep all been given as normal SOQL is working fine . – AvengerSF Oct 16 '19 at 3:34
0

Do you think it needs the namespace of the managed package as described here: https://developer.salesforce.com/forums/?id=906F00000008xoRIAQ

Have you tried something like this:

   searchQuery = 'FIND \'' + searchString + '\' IN ALL FIELDS RETURNING namespace__customobject__c( a__c,b__c';
                searchQuery += ' where namespace__Status__c=: status  and namespace__Category__c=:searchType order by namespace__Category__c ASC ';
                searchQuery += ' limit 2000 )';
                system.debug(searchQuery);
                List<List<customobject__c>> fnlOp = search.query(searchQuery);
                system.debug('O/P coming empty : '+fnlOp);
                newList = (List<customobject__c>)searchConLead[0];
                totalCount=newList.size();

As described in the link?

|improve this answer|||||

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.