+ Start a Discussion
Himanshu Patel 55Himanshu Patel 55 

VF_PAGE_MESSAGE|No applicable approval process was found

Hi Guys, 

I am having a problem with Auto Approval process when case is created from Customer Community. This process was designed few years ago and working fine until last week. Suddently Auto approval functionality not working. 

Below is from debug log 

11:06:36.0 (789572586)|WF_RULE_FILTER|[Case : Case Record Type equals Vet Refusal, Complaint] AND
 ([Case : Case Origin equals Veterinary Portal] OR
 ([Case : Case Origin equals Web form] AND
 [Account : Account Record Type equals Veterinarian, Veterinarian School]))
11:06:36.0 (789599544)|WF_RULE_EVAL_VALUE|01250000000Qn2F
11:06:36.0 (790013307)|WF_RULE_EVAL_VALUE|Web form
11:06:36.0 (790025657)|WF_RULE_EVAL_VALUE|Web form
11:06:36.0 (790038537)|WF_RULE_EVAL_VALUE|0121T000000ARoR
11:06:36.0 (790050307)|WF_EVAL_ENTRY_CRITERIA|Palatability Refusals Process|00X50000001a8hG|false
11:06:36.0 (790087611)|WF_PROCESS_FOUND||No applicable approval process was found.
11:06:36.0 (790841041)|CODE_UNIT_FINISHED|Workflow:ApprovalProcessActions
11:06:36.0 (790980116)|DML_END|[251]
11:06:36.0 (791029629)|EXCEPTION_THROWN|[251]|System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
11:06:36.0 (791458699)|HEAP_ALLOCATE|[251]|Bytes:127
11:06:36.0 (791511759)|VARIABLE_SCOPE_BEGIN|[257]|e|System.DmlException|true|false
11:06:36.0 (791603768)|VARIABLE_ASSIGNMENT|[257]|e|"common.apex.runtime.impl.DmlExecutionException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []"|0x30f3a637

(791710185)|USER_DEBUG|[258]|DEBUG|PalatabilityRefusal_NewCaseController: Exception while submitting for approval: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
below is from Controller page

 
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Auto-Submitted by controller for Approval.');
        req1.setObjectId(thisCase.id);
        
        System.debug('PalatabilityRefusal_NewCaseController:  Process Approval Request: '+ req1);
        Approval.ProcessResult result;
        try{
            result = Approval.process(req1);
            if (!result.isSuccess()){
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'An Error Occurred when submitting the request.  Please contact your administrator.'));
                return (null);
            }
            System.debug('PalatabilityRefusal_NewCaseController: Successfully submitted for approval.');
        }catch(System.DMLException e){
            System.debug('PalatabilityRefusal_NewCaseController: Exception while submitting for approval: '+e);
            System.debug('PalatabilityRefusal_NewCaseController: Exception trace: '+e.getStackTraceString());
            System.debug('PalatabilityRefusal_NewCaseController: Exception details: '+e.getDMLId(0));
            System.debug('PalatabilityRefusal_NewCaseController: Exception details: '+e.getDMLFields(0));
            System.debug(thisCase);
            hasErrors = true;
            ApexPages.addMessages(e);
            return (null);
        }
W

We used to receive message in Approval Process Comments that "Auto-Submitted by controller for Approval." but right now we have to manually submit it. It's working fine in manual Approval. 

Somehow it stopped working through Controller. Let me know if you need more details to understand it better. 

What do you suggest. 

Thanks in advance. 
Best Answer chosen by Himanshu Patel 55
Himanshu Patel 55Himanshu Patel 55
Yes I found solution afterward. Salesforce done a bug fixes a month ago where approval will check two fields Initial Submitter as well as Entry Criteria. Since my approval was triggered by Apex code and Record Creator is not always Case owner so System was not able to find any approval. I had added Initial Submitters in Approval as RECORD CREATOR along with Case Owner and that solved the problem. Try this and let me know for any problem. Thanks, Himanshu

All Answers

Himanshu Patel 55Himanshu Patel 55
Hellow Developers, Anyone can help here?
 
Kruthika KsKruthika Ks
Were you able to resolve this issue, I am running into same problem, it was all working ok and all of sudden stopped working. I am invoking the AP from controller. 
Himanshu Patel 55Himanshu Patel 55
Yes I found solution afterward. Salesforce done a bug fixes a month ago where approval will check two fields Initial Submitter as well as Entry Criteria. Since my approval was triggered by Apex code and Record Creator is not always Case owner so System was not able to find any approval. I had added Initial Submitters in Approval as RECORD CREATOR along with Case Owner and that solved the problem. Try this and let me know for any problem. Thanks, Himanshu
This was selected as the best answer
Kruthika KsKruthika Ks
Yes that was the issue, I added Record creator for the initial submitter and it worked :) Thank you so much I suspected that the issue was not coding because there was no code change and the functionality stopped working all of sudden. 
Thanks again for the quick response as well. 
Kruthika KsKruthika Ks
Also, it will be good if you can point out what was the change from SF a month ago on about Approvals