function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RepsReps 

Visual Process Manager and Apex Class

I have an ok understanding of apex and I am new to VPM (Flow Designer).

 

I am trying to get "Apex Callout" to work with a class i have but am not getting anywhere. After opening the flow designer pdf i came across the following statement:

 

"The visual Apex callout element allows you to call an Apex class with the Process.Plugin interface"

What is the process.plugin interface? because i am getting the following error when uploading the flow into Salesforce

"ErrorWe had trouble uploading the flow. Apex class does not exist or is not a plugin class: FlowDesignerISA.GetISAamount"

Can anyone help?
Thanks in-advance.

RepsReps

From flow designer when i run my flow i get the following error:

 

"com.sforce.ws.SoapFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: 00DP00000005fO8!AR4AQKfp8PE8vTgaDc__quPVPdLx5y3XsHa5bn77IAvYh37ZKa6GwADYO_EHrPugx4NX93OXoQO07DNW8iklAuxIuhJ0zyDe"

 

VPrakashVPrakash

I think you have to Implement the Process.Plugin interface to your class 

RepsReps

how do i do that? I cant seem to find any documenatation on it.

RobertTaggartRobertTaggart

I would like to know as well

cvuyyurucvuyyuru

Can you please share me something of what you done about Flows.

 

We should use process plugin interface when we try to call an Apex Class from flow.

 

Dont know about it. Please tell me how it works, if anyone succeeds.

 

 

 

Regards,

 

Charan

 

 

DrawloopSupportDrawloopSupport

You can read about the Process.Plugin Interface here:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_plugin.htm

 

If anyone has detailed information on using this in conjunction with the Apex Callout in the Flow Designer, please post links.

 

Thank you.

cedgcedg

Hello,

here is what i did to use the Apex callout in my flow.

 

I use it to manage the multilingual in the flow: the flow is unique and the translations of the questions are stored in the Custom Settings (Flow_Display_Text_2__c  object)

 

The Apex class called by the Apex callout (based on some code found in the doc (but i don't find the url back)) :-(

 

 

global class TranslationsFlow implements Process.Plugin { 

public class TranslationException extends Exception {} global Process.PluginResult invoke(Process.PluginRequest request) { // Get the subject of the Chatter post from the flow String lang = (String) request.inputParameters.get('lang'); String process = (String) request.inputParameters.get('process'); Flow_Display_Text_2__c[] res = [SELECT AAA_Q_BP_Number__c, AAA_POM_Allowed__c, AAA_POM_Error__c FROM Flow_Display_Text_2__c WHERE Name =: lang]; if (res.size() != 1) throw new TranslationException('System error: translation '+lang+' not supported'); // return to Flow Map<String,String> result = new Map<String,String>(); result.put('AAA_Q_BP_Number__c',res[0].AAA_Q_BP_Number__c); result.put('AAA_POM_Allowed__c',res[0].AAA_POM_Allowed__c); result.put('AAA_POM_Error__c',res[0].AAA_POM_Error__c); return new Process.PluginResult(result); }

 and other function i didn't change (from the documentation)

 

    // Returns the describe information for the interface  
    
    global Process.PluginDescribeResult describe() { 
        Process.PluginDescribeResult result = new Process.PluginDescribeResult(); 
        result.inputParameters = new 
           List<Process.PluginDescribeResult.InputParameter>{ 
               new Process.PluginDescribeResult.InputParameter('subject', 
               Process.PluginDescribeResult.ParameterType.STRING, true) 
            }; 
        result.outputParameters = new 
           List<Process.PluginDescribeResult.OutputParameter>{ }; 
        return result; 
    }
}

 

In my flow, i've a Value Table for input "VT Translations Input" with 2 keys 'lang' and 'process'. And another Value Table for output "VT Translations Output" with 3 keys 'AAA_Q_BP_Number__c', 'AAA_POM_Allowed__c' and 'AAA_POM_Error__c' (defined explicitly in the Value Table)

 

Then I've just to add the Apex callout with input

- Apex classname : TranslationsFlow  (name of the class hereabove)

- Input Values : VT Translations Input

 

and output:

- Output values : VT Translations Output

 

It works fine, i've no error.

 

Hope it helps.

Cheers

 

 

 

JimPDXJimPDX

We too are having a similar problem with Flows and Apex Callouts. Maybe I can bump this thread and get some fresh input. We implemented 5 different Process.Plugin methods, all global and following the specs in the documentation. Now when using the beta cloud flow designer and bringing a plugin into the flow we get this error:

 

"Auth (Authorize): We can't find the Apex callout for class "ChargentOrders.TChargentPluginAuthorize". It may have been deleted or changed." 

 

Any ideas?

trmptrmp

Jim,

 

I had a case open with Salesforce support for a similar issue (if not exactly the same). Have you tried setting this up in a sandbox with the new Spring release? It is supposedly fixed there, but I haven't had a chance to test it.

 

Thanks!

MyGodItsColdMyGodItsCold

I have a developer account which I created about a week ago. I'm using the Visual Workflow Workbook.

 

I have Example 3 failing with the following:

 

"com.sforce.ws.SoapFaultException: System.NoDataFoundException: Data Not Available: The data you were trying to access could not be found. It may be due to another user deleting the data or a systme error. If you know the data is not deleted but cannot acc

(System Code)
External entry point"

 

My Premiere Support ticket is in & I'm waiting. Perhaps they changed something after they verified that all the Examples in the workbook work?

 

More to follow...

 

 

JimPDXJimPDX

I believe the problem is that our Plugin was in a managed package. I created a custom class (same logic) and it worked (well the Flow saved vs complaining about the missing callout). Hopefully Spring 12 will fix it. No I don't (yet) have a Spring 12 org setup but great idea!

Maurizio BellaMaurizio Bella

Dear cedg,
thanks again for your code. It was really usefully
can you post your value table elements,please? in your code what's the key name and key value?
I'm not able to print the output in a next insert statement.
thanks,
Mauri

cedgcedg

Dear Maurizio,

 

as far as i remember (we didn't make this project finally) 

 

the value tables are

"VT Translations Input"

key name = "lang" , key value = "vaLanguage"  where vaLanguage is a variable element

key name = "process", key value = "Process" where Process is a variable element

these will be used in my apex callout to load the correct translation (of the correct process but i don't use it in this case)

 

"VT Translations Output"

{AAA_Q_BP_Number__c  =>  DT_Q_BP_Number,

AAA_POM_Allowed__c  => DT_POM_Allowed,

AAA_POM_Error__c => DT_POM_Error}

where the values are variable elements.

the keys of the output map of the apex callout correspond to the keys of this value table. The variable elements are set with the values of the output map and can be used in the next statements (as they are now variable elements).

 

In the insert statement, i use in the display box for example:

[DT_POM_Error]

 

Cheers

Ced

Maurizio BellaMaurizio Bella

Dear Cedg,
thanks again for your answer.
I think that I found the problem. I don't understand why but the class doesn't work fine on my Flow designer 7.0.6 on my windows XP machine. I've created a flow with only an apex class callout, with input and output, too.
If I try to run it seems to do nothing, but if I try to upload the file .flow into salesforce (flows menu) I display back this error: "We had trouble uploading the flow. Apex class does not exist or is not a plugin class: CalculateMortgage"
this class is a Process.Plugin class (this is a test class from official salesforce documentation wb_flow_designer.pdf)
global class CalculateMortgage implements Process.Plugin {
global Process.PluginResult invoke(Process.PluginRequest request) {
Decimal anAmount = (Decimal) request.inputParameters.get('Amount');
Decimal aTerm= (Decimal) request.inputParameters.get('Term');
Map<String,Object> result = new Map<String,Object>();
result.put('MonthlyAmount',5000);
return new Process.PluginResult(result);
}
global Process.PluginDescribeResult describe() {
Process.PluginDescribeResult result = new Process.PluginDescribeResult();
result.inputParameters = new List<Process.PluginDescribeResult.InputParameter>{
new Process.PluginDescribeResult.InputParameter('Amount',
Process.PluginDescribeResult.ParameterType.DECIMAL, true),
new Process.PluginDescribeResult.InputParameter('Term',
Process.PluginDescribeResult.ParameterType.DECIMAL, false)
};
result.outputParameters = new List<Process.PluginDescribeResult.OutputParameter>{
new Process.PluginDescribeResult.OutputParameter('MonthlyAmount',
Process.PluginDescribeResult.ParameterType.DECIMAL)
};
return result;
}
}

 

as per image attached the cloud flow recognizes it.
Very strange behavior, isn't?. Any idea?