You need to sign in to do that
Don't have an account?
Compile Error: Method does not exist or incorrect signature:
Hi,
Trying to write a method to get Approver from an approval process. Not sure if this is the way to do it. But getting this error on a trigger
trigger UpdateActor on Expense__c (before update) {
ProcessInstanceStep instance = new ProcessInstanceStep();
Expense__c exp = new Expense__c();
exp = [select id from Expense__c where id=:trigger.new[0].Id];
if(trigger.isUpdate && !exp.isEmpty())
{
instance = [select id from ProcessInstanceStep where id=:exp.id];
exp.Approved_by__c = instance.ActorId;
}
}
If anyone knows anything, please help!
Trying to write a method to get Approver from an approval process. Not sure if this is the way to do it. But getting this error on a trigger
trigger UpdateActor on Expense__c (before update) {
ProcessInstanceStep instance = new ProcessInstanceStep();
Expense__c exp = new Expense__c();
exp = [select id from Expense__c where id=:trigger.new[0].Id];
if(trigger.isUpdate && !exp.isEmpty())
{
instance = [select id from ProcessInstanceStep where id=:exp.id];
exp.Approved_by__c = instance.ActorId;
}
}
If anyone knows anything, please help!
List<ProcessInstance> instances = [select Id, Status, TargetObjectId,(select ActorId, Comments, ProcessInstanceId, OriginalActorId, StepStatus from Steps)from ProcessInstance where TargetObjectId =: exp.id limit 10];
That's what I was missing.
All Answers
exp = [select id from Expense__c where id=:exp.Id];
system.QueryException: List has no rows for assignment to SObject: Trigger.UpdateActor: line 10, column 1
I think it's because ProcessInstanceStep doesn't have id field. So how do I map the ActorId from the record I'm trying to update?
List<ProcessInstance> instances = [select Id, Status, TargetObjectId,(select ActorId, Comments, ProcessInstanceId, OriginalActorId, StepStatus from Steps)from ProcessInstance where TargetObjectId =: exp.id limit 10];
That's what I was missing.