You need to sign in to do that
Don't have an account?
Process failed.: NO_APPLICABLE_PROCESS, No applicable approval process found error
Hi,
trigger QuoteSubmitForApproval on QuoteLineItem (after insert,after update)
{
List<QuoteLineItem> qLineItem =new List<QuoteLineItem>();
qLineItem=[select id,quoteId,quote.status,PricebookEntryId,PricebookEntry.Pricebook2Id,Discount,PricebookEntry.Product2Id,PricebookEntry.Product2.name,PricebookEntry.Product2.UAE_Discount__c from QuoteLineItem where id=:Trigger.newMap.keySet()];
//User u = [select id,ManagerId from User where Id =: Userinfo.getUserId()];
Set<String> quoteIds=new Set<String>();
for(Integer i = 0;i<qLineItem.Size();i++)
{
System.debug('----i-----'+i);
System.debug('-----QlineItem Discount----'+qLineItem[i].Discount);
System.debug('------Product Discount------'+qLineItem[i].PricebookEntry.Product2.UAE_Discount__c);
if((qLineItem[i].Discount > qLineItem[i].PricebookEntry.Product2.UAE_Discount__c) && (qLineItem[i].quote.status <> 'Approved') && (qLineItem[i].quote.status <> 'Accepted') /*&& (u.ManagerId!=null)*/ )
{
if(!(quoteIds.contains(qLineItem[i].QuoteId)))
{
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for Approval. Please Review');
req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
req.setObjectId(qLineItem[i].QuoteId);
Approval.ProcessResult result = Approval.Process(req);
System.debug('Submitted for approval successfully: '+result.isSuccess());
quoteIds.add(qLineItem[i].QuoteId);
}
}
else
{
System.debug('No Manager for this User');
}
}
}
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger QuoteSubmitForApproval caused an unexpected exception, contact your administrator: QuoteSubmitForApproval: execution of AfterInsert caused by: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process found.: []: Trigger.QuoteSubmitForApproval: line 20, column 1
.......When i am trying to create a quote, i was throwing the above exception.
Anyone please suggest, how to overcome on this ...
Hi Here ,
Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
This class Have only
getComments
setComments
getNextApproverIds
setNextApproverIds
getObjectId
setObjectId
These methods
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessSubmitRequest.htm
I think i.e your problm
or
Check your permissions
Hi,
check if in your approval process, there's a criteria that match with this case.
If there's a criteria, this quoteLineItem should attend for these conditions of approval process criteria.
Regards
Agreed with Rodrigo,please make sure that you are meeting the criteria which is required to invoke the Approval process in your record which is being inserted.
It was not solved :(
1 ) Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for Approval. Please Review');
req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
req.setObjectId(qLineItem[i].QuoteId);
I am using the methods as mentioned above. Even i am getting the above exception.
2 ) if((qLineItem[i].Discount) > (qLineItem[i].PricebookEntry.Product2.UAE_Discount__c) && qLineItem[i].quote.status <> 'Approved' && qLineItem[i].quote.status <> 'Accepted')
from above statement, i am specifying the entry criteria as, if quotelineitem discount percent is greater than that particular product UAE_Discount__c percent, then it should go for approval.
i.e ; (qLineItem[i].Discount) > (qLineItem[i].PricebookEntry.Product2.UAE_Discount__c)
so what is bug in my code,
please specify the bug n my code..
Thanks in Advance,
Karthik.
Still i am getting the same error as abpve ..
Anyone of u suggest me , how to overcome this ..
Thanks in Advance
The way to debug this is to go to your Debug Log and ensure you are logging Workflow events. Here is an example from my org:
As you can see, the NO_PROCESS_FOUND error occurs if one doesn't have any Approval Processes for the object in question whose entry criteria is met.
when I'm trying to create an approval process for a chatter feed, it throwing an error called..
System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []
Plz help me.
Regards
Ravi Chandra