+ Start a Discussion
Alejandro MirandaAlejandro Miranda 

Invoke a Flow with Apex Class. Constructor not defined

Hi All,

I am having problems when I try to invoke a Flow with Apex. I'm having the next problem:

Constructor not defined: [Flow.Interview.Asociado_correo_secundario_al_EmailMessage].<Constructor>(Id)

This is the part of code:

  public void beforeInsert(SObject so) {
        Case cas = (Case)so;
            MainCaseAnalyzer mCA = new MainCaseAnalyzer();
            system.debug('CASO BEFORE INSERT: ' + cas); 
        List<EmailMessage> emailMessageList = [SELECT id,parentId FROM EmailMessage WHERE parentId =: cas.id limit 1];
        Flow.Interview.Asociado_correo_secundario_al_EmailMessage flow = new        Flow.Interview.Asociado_correo_secundario_al_EmailMessage(emailMessageList[0].id);

Any idea how to do it?

Thanks in advance!
deepak balur 19deepak balur 19
Please refer to the following link: http://andyinthecloud.com/2014/10/26/calling-flow-from-apex/. This will help your refine your flow invocation from APEX. 
Alejandro MirandaAlejandro Miranda
Thank you for your help ;)