I am trying to use following apex class with invocable method but its not showing in process builder.

global with sharing class SlackOpportunityPublisher {

    private static final String slackURL = 'https://testsalesforceapps.slack.com/';

    global class Oppty {
        @InvocableVariable(label='Opportunity Name')
        global String opptyName;
        global String stage;

    @InvocableMethod(label='Post to Slack')
    global static void postToSlack(List<Oppty> oppties) {
        Oppty o = oppties[0]; // If bulk, only post first to avoid overloading Slack channel
        Map<String,Object> msg = new Map<String,Object>();
        msg.put('text', 'The following opportunity has changed:\n' + o.opptyName + '\nNew Stage: *' + o.stage + '*');
        msg.put('mrkdwn', true);
        String body = JSON.serialize(msg);    
        System.enqueueJob(new QueueableSlackCall(slackURL, 'POST', body));

    global class QueueableSlackCall implements System.Queueable, Database.AllowsCallouts {

        private final String url;
        private final String method;
        private final String body;

        global QueueableSlackCall(String url, String method, String body) {
            this.url = url;
            this.method = method;
            this.body = body;

        global void execute(System.QueueableContext ctx) {
            HttpRequest req = new HttpRequest();
            Http http = new Http();
            HttpResponse res = http.send(req);


  • I suppose your process builder on Opportunity.
    – Raul
    Commented Sep 27, 2017 at 14:14
  • yes you are right!
    – sekhar
    Commented Sep 27, 2017 at 14:17
  • Changing signature of class and/or method to public make any difference?
    – Raul
    Commented Sep 27, 2017 at 14:21
  • I tried before with public also but that time also faced same problem
    – sekhar
    Commented Sep 27, 2017 at 14:25
  • 1
    I copy pasted your class in my dev org and it works!! Issue is similar to this question. Try creating a new class and see if it appears?
    – Raul
    Commented Sep 27, 2017 at 14:34

5 Answers 5


This problem often resolves itself by going to Setup | Develop | Apex Classes | select the test class and then run tests. SFDC needs to be sure class has been tested to appear in dropdown.

Solution also applies to Schedulable classes, Inbound Email Handler classes

  • Great to know the solution. Thanks for sharing. But this doesn’t make sense, shouldn’t it register the class while creation? Also would compile all classes also work instead of running test class?
    – Raul
    Commented Sep 27, 2017 at 18:13
  • 1
    @RahulSharma - all I can say is I learned this trick from elsewhere and it works
    – cropredy
    Commented Sep 27, 2017 at 23:44
  • 2
    @Raul I can confirm the compile all classes solution works, independent of test coverage. In a dev org, I have methods that show up after 'compile all' that have no coverage whatsoever.
    – Vince
    Commented Feb 7, 2019 at 19:20

Go to Apex class list > compile all the classes

That should solve the issue.

  • This worked once for me and then it disappeared again and only showed up after I added test coverage :shrug:
    – NSjonas
    Commented Jun 4, 2020 at 19:45

You have to completely exit from Process Builder and come back in for it to refresh the Apex list.


Go to your apex class, copy all of the code, create a new apex class, paste your code there, change the class name slightly, make sure your method is invocable and has a label, save the class. Now search for your method label from within process builder.

  • Please give some logical answers, when you post an answer. Commented Apr 1, 2020 at 0:20

Another workaround is to change the method parameter.

Switching to List<Id> instead of List<Sobject> worked for me.

You must log in to answer this question.

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