• Ravi Chandra 64
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hey guys!
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
Hey guys!
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

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 ...