You need to sign in to do that
Don't have an account?
Apex Workflow Plugin - Problem with the I/O in a Visual Workflow
I have been debugging a strange I/O issue that I've encountered with an Apex Plugin I'm trying to implement into a Visual Workflow. I have been trying to use Apex to successfully handle an input string parameter and pass it to an output string parameter. In other words, Visual Workflow throws up a screen for the user to enter a value, he/she hits the “Next” button, and an Apex Plugin takes their input and pushes it to a completely different variable.
Here is an outline of the flow:
- Screen: debug001; Input Textbox: Input for “CurrentId” Var
- Apex Trigger: Send Email Plugin; Input: CampId => "CurrentId", Output: AccountId => "TextString001"
- String: debug002; Output Text: {!TextString001}
Here is the code for the Apex Plugin:
global with sharing class CreateSendGridEmail implements Process.Plugin { global Process.PluginResult invoke(Process.PluginRequest request) { String CampId = (String) request.inputParameters.get('CampId'); system.debug(CampId); // return to Flow Map<String,Object> result = new Map<String,Object>(); result.put('AccountID', CampId); return new Process.PluginResult(result); } global Process.PluginDescribeResult describe() { Process.PluginDescribeResult result = new Process.PluginDescribeResult(); result.Name = 'SendGrid Send One-Off Email'; result.Tag = 'Email'; result.inputParameters = new List<Process.PluginDescribeResult.InputParameter>{ new Process.PluginDescribeResult.InputParameter('CampId', Process.PluginDescribeResult.ParameterType.STRING, true) }; result.outputParameters = new List<Process.PluginDescribeResult.OutputParameter>{ new Process.PluginDescribeResult.OutputParameter('AccountID', Process.PluginDescribeResult.ParameterType.STRING) }; return result; } }
The problem occurs in the final screen of the Visual Workflow. The screen is completely blank. Looking in the debug logs. The variable "CampId" returns null. For some reason my code is unable to pull the input parameter’s source from the flow. At this point, I feel lost on how to resolve this issue. I looked at multiple other Process.Plugin examples and code snippets, but I can’t find anything that I’m missing. I was hoping to see if there were any developers out there who could give me some assistance with this issue. I'm thankful for any and all suggestions, ideas, etc. for this problem.
Thanks so much for your time.
Your plugin looks good to me (without compiling it or having the context of what your flow looks like) so I'd check how you're invoking the Plugin from your flow.
-Andy