You need to sign in to do that
Don't have an account?
Thierry JORAND
Illegal argument in an invocable method
I encountered the following message in debug log :
Class.FlowContact.createCustomer: line 21, column 1 22:43:19.052 (52187112)|FATAL_ERROR|System.UnexpectedException: Illegal arguments
public class FlowContact {
public class Customer {
@InvocableVariable
public Contact inContact;
}
// Response
public class Response {
@InvocableVariable
public String status;
}
@InvocableMethod(label='createCustomer' description='Call createCustomer ') public static List<Response> createCustomer(List<Customer> customers) { List<Response> resps = new List<Response> (); Response resp = new Response(); System.debug('createCustomer Contact Id '+customers[0].inContact.Id);
String strSalutation = customers[0].inContact.Salutation;
System.debug('createCustomer Contact '+ strSalutation); // line 21 is here System.debug('createCustomer Contact fn '+customers[0].inContact.firstName); System.debug('createCustomer Contact ln'+customers[0].inContact.lastName); System.debug('createCustomer Contact n'+customers[0].inContact.Name);
resp.status='0';
resps.add(resp);
return resps;
}
}
This method is called from a flow with firstname, lastname and Salutation which are fullfilled
Do you have any clue ?
Thanks in advance
Class.FlowContact.createCustomer: line 21, column 1 22:43:19.052 (52187112)|FATAL_ERROR|System.UnexpectedException: Illegal arguments
public class FlowContact {
public class Customer {
@InvocableVariable
public Contact inContact;
}
// Response
public class Response {
@InvocableVariable
public String status;
}
@InvocableMethod(label='createCustomer' description='Call createCustomer ') public static List<Response> createCustomer(List<Customer> customers) { List<Response> resps = new List<Response> (); Response resp = new Response(); System.debug('createCustomer Contact Id '+customers[0].inContact.Id);
String strSalutation = customers[0].inContact.Salutation;
System.debug('createCustomer Contact '+ strSalutation); // line 21 is here System.debug('createCustomer Contact fn '+customers[0].inContact.firstName); System.debug('createCustomer Contact ln'+customers[0].inContact.lastName); System.debug('createCustomer Contact n'+customers[0].inContact.Name);
resp.status='0';
resps.add(resp);
return resps;
}
}
This method is called from a flow with firstname, lastname and Salutation which are fullfilled
Do you have any clue ?
Thanks in advance
But, as I can't stay stucked with that, I applied the following ( quite dirty) workaround :
public class FlowContact {
public class Customer {
@InvocableVariable
public Contact inContact;
@InvocableVariable
public String inSalutation;
}
In the method createCustomer, I totally ignore the Salutation from the Contact object and use the replacement String inSalutation.
String strSalutation = String.valueOf(customers[0].inContact.Salutation);