I have create a custom object in which i have a custom button to send email. I was able to send email. Until i packaged it. My code before package:

var r = confirm("Do you want to email this position to CM-Focus.");
if(r == true)
alert("Thanks for sending email to CM-Focus.");

after package the code get changed and the namespace get added to the code CMSR__ with Position__c.Id. I installed the package the installed package do not contain the namespace so from there i am able to send email. But in the development env i am getting an error that:

A problem with the OnClick JavaScript for this button or link was encountered: {faultcode:'soapenv:Client', faultstring:'No operation available for request {http://soap.sforce.com/schemas/package/ctrl_sendEmail_ToCM}sendEmail, please check the WSDL for the service.', }

The only difference between the developer env code and installed env code is the namespace. Dose this namespace make any difference. Or this issue is due to any other reason. My apex class code:

  webservice static void sendEmail(string jId){


    //set all the contents for email
    //String[] toaddress = new String[]{'positionemailtolead@t-1j7i9bcxptr0wlspn7vozeowvb1447pr9gl6vxszhawlzi3n9m.a-h3zcmac.na7.apex.salesforce.com', '[email protected]'};  

   /* Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
    msg.setToAddresses(new String[] {'anuraj@'});
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { msg });

    Id jobID;// To get the position ID from URL
    Position__c posDetails = new Position__c();   // To get the all the records releted to jobID

    jobID = jId;       
    //jobID = ApexPages.currentPage().getParameters().get('Id'); // Getting the postion Id from URL  

     //SOQL position
    posDetails = [SELECT Name, Account__r.Name, Country__c, Departments__c,Job_Description__c,
                    Job_Type__c, Location__c, Location_State__c, Max_years_of_Exp__c, Min_Years_of_Exp__c,
                    Required_Qualifications_and_Skills__c, Responsibilities__c, Summary__c, Skills_Required__c
                    FROM Position__c WHERE id =:jobID];

    //Email Body 
    emailBody = 'Position Name :' + posDetails.Name+'\n----------------- Account Name :' + posDetails.Account__r.Name+'\n----------------- Country :'+posDetails.Country__c+'\n----------------- Departments :'
                 +posDetails.Departments__c+'\n----------------- Job Description :'+posDetails.Job_Description__c+'\n----------------- Job Type :' + posDetails.Job_Type__c+'\n----------------- Location :'
                 +posDetails.Location__c+'\n----------------- Location State :'+posDetails.Location_State__c+'\n----------------- Max Exp :'+posDetails.Max_years_of_Exp__c+'\n----------------- Min Exp :'
                 +posDetails.Min_Years_of_Exp__c+'\n----------------- Required Qualifications :'+ posDetails.Required_Qualifications_and_Skills__c+'\n----------------- Responsibilities :'+ posDetails.Responsibilities__c
                 +'\n----------------- Summary :'+posDetails.Summary__c+'\n----------------- Skills :'+posDetails.Skills_Required__c;

    //emailBody = emailBodyInweb;

    String[] toaddress = new String[]{'[email protected]'};
    //String[] toaddress = new String[]{'positionemailtolead@t-1j7i9bcxptr0wlspn7vozeowvb1447pr9gl6vxszhawlzi3n9m.a-h3zcmac.na7.apex.salesforce.com'};
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();     
    mail.setsubject('Job postion ');
    mail.setPlainTextBody (emailBody);  
   // system.debug('Email body before sending ' + emailBody);

    //send email
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });           


This is a global class. Please help me to get this issue solved.

1 Answer 1


Your apex webservice invocation will also need a namespace prefix added, from




Note the difference in how apex classes are referenced (namespace followed by a .) is different than how SObjects are (namespace followed by double underscore).

  • Look again, you need the namespace on the apex class name as well. CSMR.ctrl_... Commented Mar 26, 2014 at 5:45

You must log in to answer this question.

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