0

I have (hopefully) a simple problem. I am calling a flow from a Detail Page Button:

/flow/Send_Message?objectId={!Account.Id}

Send_Message flow starts on a Screen block. The Screen has two String input fields:

enter image description here

These input fields I save to a variable and pass to an APEX class:

enter image description here

When I run the flow, I am able to get into the APEX class but the Message and Email_or_Text values are not carrying over. This means to me that they are not saving in the flow. I THINK it has to do with the fact that there is no finish button on the flow. My end goal is to have the APEX class do a redirect. So there is no need for a end screen. I am not sure if there is a way around this. Am I setting the flow and apex correctly?

APEX Class:

public class SendMessage implements Process.Plugin {
    public String objectId;
    public String message;
    public String email_or_text;

    public Process.PluginResult invoke(Process.PluginRequest request) {
        Map<String, Object> result = new Map<String, Object>();
        objectId = (String) request.inputParameters.get('objectId');
        message = (String) request.inputParameters.get('message');
        email_or_text = (String) request.inputParameters.get('email_or_text');

        system.debug('values:: ' + objectId + message + email_or_text);
        return new Process.PluginResult(result);
    }

    public Process.PluginDescribeResult describe() {......

enter image description here

1 Answer 1

1

It looks like you aren't adding any values to your result map. From the looks of your code, I think you meant to add objectId, message, and email_or_text to the map first. That would explain why nothing is coming back! ;)

I don't think you can redirect to a new page from apex, unless it's part of a Visualforce page controller or extension. Instead of using Apex, take a look at the new Local Actions that are available for Flow. I have a feeling that's the only way to do

Redirect Flow Users with a Local Action

2
  • thank you for your feedback. I shouldn't have to add values to the result map to get the input values. When I debug the values I get: ('values:: 0016sd32fs454gf null null); the input values should be saved to the variables message and email_or_text.
    – Olivia
    Commented Oct 8, 2018 at 12:29
  • ah I figured it out. I ended up calling the flow from the URL and fat fingered the parameter in the URL. When I fixed it, the email_or_text and message variables were able to be updated! As for the redirect, thank you for the link, I will look into Local Actions.
    – Olivia
    Commented Oct 8, 2018 at 12:52

You must log in to answer this question.

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