1

I got the following error: Error Occurred During Flow "Send Slack Messages": Apex request count has exceeded limit.

The "Send Slack Messages" flow is a custom flow that simply loops through a collection of an Apex-defined type SlackMessage and sends them using the Send Slack Message action from Flow Core Actions for Slack.

enter image description here

The flow is being called from an Apex queueable, something like this:

public class SlackMessageSenderWithFlow implements SlackMessageSender {

    private static final String FLOW_SEND_SLACK_MESSAGE = 'Send_Slack_Messages';

    public void send(List<SlackMessage> messages) {
        Flow.Interview.createInterview(FLOW_SEND_SLACK_MESSAGE, new Map<String, Object> {
                'vc_SlackMessages' => messages
        }).start();
    }
}
public class AQueueable implements Queueable {

    public void execute(QueueableContext ctx) {
        // ...
        sender.send(messages);
    }
}

The error is thrown with just 2 messages, so it's not a callout limit related error.

Is this error due to some kind of limitation of Salesforce flows? The documentation about the Flow.Interview class doesn't state any limitations regarding this situation. I also have not been able to find any information about this error message.

3
  • Hmm -- try putting a Pause element after each Send Slack Message action (hopefully there's a better answer than this). I presume from debug that the Send Slack Message action doesn't trigger other automation that is where the limit breach occurs. You could also loop through each message by calling the Flow.Interview start() once per message
    – cropredy
    Mar 9 at 2:00
  • I tried with just 1 message, and the same error occurs. I think it must be something related to the way the action is called (a queueable that executes a Flow, that runs a Slack action). I tried to use SlackMessageSenderWithFlow to send multiple messages (50) from the developer console, and it works perfectly.
    – kumquat3
    Mar 9 at 11:54
  • does your queueable execute() do anything other than invoke a FlowInterview start()?
    – cropredy
    Mar 9 at 14:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.