You need to sign in to do that
Don't have an account?
Luca Benedettini 7
Pass a caso to an apex class from process builder
I use a process builder after a creation on one case, it has to call an apex class taht update one look up on that record. That is my apex class:
public class SetField{
@InvocableMethod
public static void Set(List<Id> casoid){
Case Caso=[select Id from Case where id=:casoid];
Caso.Working_Status__c='JUST CREATED';
Caso.Environment_Type__c='Production';
ID contratto= [select ID,(select ID from Contracts) from Account where Id=:Caso.AccountID].Contracts.get(0).ID;
caso.Contract_Number__c=contratto;
}
}
and in the process builder in Set Apex Variables I set:
casoid - ID-CaseId
But constantly I encounter the error :
Error Occurred: An Apex error occurred: System.QueryException: List has no rows for assignment to SObject.
I need your help to fix this please.
public class SetField{
@InvocableMethod
public static void Set(List<Id> casoid){
Case Caso=[select Id from Case where id=:casoid];
Caso.Working_Status__c='JUST CREATED';
Caso.Environment_Type__c='Production';
ID contratto= [select ID,(select ID from Contracts) from Account where Id=:Caso.AccountID].Contracts.get(0).ID;
caso.Contract_Number__c=contratto;
}
}
and in the process builder in Set Apex Variables I set:
casoid - ID-CaseId
But constantly I encounter the error :
Error Occurred: An Apex error occurred: System.QueryException: List has no rows for assignment to SObject.
I need your help to fix this please.