Only able to call Apex in Sandbox

edited February 23, 2018 in Questions
Hello Everyone

I stumbled across a squite painful problem.
I built a skuidpage which calls a apex to send mails upon buttonclick. It all works perfectly fine in Sandbox, but we pushed it to a live org and it just plain out fails

i get this error in the console:


the Apex looks as follows:
public class SendMailsToParticipants{ 
static void SendMails(List<String> emails) {  
static void SendMails(List<String> emails) {  
        String eventId = recipients[0];
        Event e = [SELECT id FROM Event WHERE id = :eventId];
        List<Messaging.SingleEmailMessage> mailList =  new List<Messaging.SingleEmailMessage>();
        for(String recipient : recipients){
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();mail.setTemplateId([select id from EmailTemplate where developername='EventUpdatedEmail'].id);mail.setTargetObjectId([SELECT id FROM User WHERE id = :recipient].id);mail.saveAsActivity = false;mail.setWhatId(;mailList.add(mail);
} String [] recipients = emails.get(0).split(',');
i can't figure out why its failing, the users have rights and i use the exat same data to test on live as on sandbox

Any ideas?


  • edited September 3, 2016

    Try and reduce your URL to just /apex/SendMailsToParticipants

  • edited February 23, 2018
    Thanks for the Idea Gregg, Unfortunely i can't alter the URL path. I call it as "Run Custom Apex Action".Therefore the URL gets built automatic

  • edited September 3, 2016
    Hi Matti

    Log into the production Org and paste this into the URL:

    This will tell you what you are getting.

    It may be a compile error relating to that only top-level class methods can be declared static.

    Try that and let me know.

  • edited March 2, 2017
    Do Users in Production have access on their Profile / via assigned Permission Sets to your SendMailsToParticipants Apex Class?
  • edited June 2, 2017
    Any update on this I have the same issue?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!