You need to sign in to do that
Don't have an account?
Package Visibility: Constructor is not visible:
Hi Experts,
I have created one Schedulable global batch class which automatically sends an emails to Task's accounts contacts. so i have schedule that class to daily run on 1:00 am. but it will give an Below exception.
Package Visibility: Constructor is not visible: [SendMassEmail].<Constructor>()
---------- code --------
global class SendMassEmail implements Database.Batchable<SObject>, Database.Stateful, Schedulable {
// variable deleractions
global SendMassEmail(){
// nothing define
}
global database.querylocator start(Database.BatchableContext bc){
// Fatching Task records.
}
global void execute(Database.BatchableContext bc, List<sObject> sObjs){
// Factching Task's Accounts and its related contact
// sendEmail();
}
global Boolean sendEmail() {
// Select Email template based on task subject and send email
}
global void finish(Database.BatchableContext bc){
System.debug('-------------- SendMassEmail FINISH ----------- ');
}
global void execute(SchedulableContext sc) {
// call batch job
SendMassEmail sme = new SendMassEmail();
Database.executeBatch(sme,1);
}
}
I copied your code verbatim, added a couple return null statements, and successfully saved the code in my developer account. Check your line numbers, as the error you're getting is probably elsewhere.
I even tried possible and added basic null as return and was able to save. -sfdcdox- sounds correct here
Hi sfdcfox & ForceLabs,
Thanks for reply. But i have created managed package and install that package to my production environmant. it gives error in prod. and no code was written in my constructor
I would guess it is related to this:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_namespace_prefix.htm
The scheduled class might need to call the SendMassEmail using its namespace prefix?
We started getting the same error after we updated our package. For some reason the global class contructor was visible in one release of the product, and then not visible in the next. We uploaded a new version of the package and the issue went away.
- Ron
Just want to jump in and say that I'm having a similar problem with our managed package. Used to be you could access the class in the package, but now I get the same message about the Constructor is not visible. Not sure what to do about it, and this is the only result in Google that mentions it.
Has anyone found a fix for this - just hit the same problem after creating our first package version on Summer 12 and am highly suspicious. As for the other postings, everthing worked in our previous version, our package controllers and their constructors are all Global, and show as global in the customer org.
Getting fed up with a string of dodgy sfdc releases undermining us.
OK, I've fixed this problem for our package by rolling back the Salesforce API on the offending Apex controller to v16 (the version we were at before this release). One of our developers had move the API to v 24 and we've changing this back fixed the problem. (Going back to v22 made no difference).
I'll raise a Case with SFDC to understand what's changed with access to Global methods since v16 that may have caused this conflict.