You need to sign in to do that
Don't have an account?

Case Trigger Not Firing Approval Process
Hello,
I have created a case trigger with the following code.....
trigger CaseApproval on Case (after insert, after update) {
for (Case currentCase : Trigger.new) {
if (currentCase.RecordType.Name == 'SF_Dev_Requests')
{
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for approval. Please approve.');
req.setObjectId(currentCase.Id);
Approval.ProcessResult result = Approval.process(req);
}
}
The trigger is not firing the approval processes when a case with the record type mentioned in the trigger code is created.
Can someone please help me understand what may be causing the trigger to not fire, and help me resolve this issue to have these types of incoming cases auto start the approval process?
Thank you for all of your help in advance,
Shawn
I have created a case trigger with the following code.....
trigger CaseApproval on Case (after insert, after update) {
for (Case currentCase : Trigger.new) {
if (currentCase.RecordType.Name == 'SF_Dev_Requests')
{
Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
req.setComments('Submitted for approval. Please approve.');
req.setObjectId(currentCase.Id);
Approval.ProcessResult result = Approval.process(req);
}
}
The trigger is not firing the approval processes when a case with the record type mentioned in the trigger code is created.
Can someone please help me understand what may be causing the trigger to not fire, and help me resolve this issue to have these types of incoming cases auto start the approval process?
Thank you for all of your help in advance,
Shawn
As is also stated in the blog:"For the trigger to work you need to have an approval process with matching criteria."
reference: http://blog.jeffdouglas.com/2010/01/04/automating-salesforce-approval-processes-with-apex-triggers/