Continuig from the issue I posted just a few hours ago - Returning a list of lists to the flow returns error saying list out of bounds
Here is my Apex action with the Invocable Method-
public with sharing class AuthPINPasswordController {
@InvocableMethod(
Label='getPINPassword'
)
public static List<List<CustomerAccountContactDto>> getPINPassword(List<Request> requestList) {
List<List<CustomerAccountContactDto>> customerAccountcontacts = new List<List<CustomerAccountContactDto>>();
List<CustomerAccountContactDto> contacts = new List<CustomerAccountContactDto>();
CustomerAccountContactDto response = new CustomerAccountContactDto();
CustomerAccountContactDto response1 = new CustomerAccountContactDto();
response.errorOcurred = false;
response.customerAccountContacts[0].contactName = 'Contact1';
response.customerAccountContacts[0].contactRoleType = 'Primary';
response.customerAccountContacts[0].decryptedPassword = 'decryptedPassword';
response.customerAccountContacts[0].passwordChangeIsRequired = false;
response.customerAccountContacts[0].passwordIsSet = true;
response.customerAccountContacts[0].hintText = 'hintText';
contacts.add(response);
response1.customerAccountContacts[1].contactName = 'Contact2';
response1.customerAccountContacts[1].contactRoleType = 'Secondary';
response1.customerAccountContacts[1].decryptedPassword = 'decryptedPassword1';
response1.customerAccountContacts[1].passwordChangeIsRequired = false;
response1.customerAccountContacts[1].passwordIsSet = true;
response1.customerAccountContacts[1].hintText = 'hintText';
contacts.add(response1);
customerAccountcontacts.add(contacts);
return customerAccountcontacts;
}
public class Request {
@InvocableVariable(required=true)
public String accountNumber;
@InvocableVariable(required=true)
public String objectId;
public Request(String accountNumber, String objectId) {
this.accountNumber = accountNumber;
this.objectId = objectId;
}
public Request() {} //NOPMD
}
public class Result {
@AuraEnabled @InvocableVariable(required=true)
public String contactName;
@AuraEnabled @InvocableVariable(required=true)
public String contactRoleType;
@InvocableVariable(required=false)
public String decryptedPassword;
@InvocableVariable(required=false)
public String hintText;
@InvocableVariable(required=false)
public Boolean passwordChangeIsRequired;
@InvocableVariable(required=false)
public Boolean passwordIsSet;
public Result() {
//set defaults
this.passwordChangeIsRequired = false;
this.passwordIsSet = false;
}
}
}
And here is Apex Defined Class which is in its own file and which I am referring and returning to the flow on the above invocable method -
public with sharing class CustomerAccountContactDto {
public CustomerAccountContactDto() {
this.errorOcurred = false;
this.errorMessage = '';
}
@AuraEnabled @InvocableVariable(required=true)
public Boolean errorOcurred;
@AuraEnabled @InvocableVariable(required=true)
public String errorMessage;
@AuraEnabled @InvocableVariable(required = true)
public List<AuthPINPasswordController.Result> customerAccountContacts;
}
Here is my Apex Defined collection variable created inside of the flow-
And here is how I am setting it as output to the apex action -
When trying to print the value of one of the fields of the collection variable, I don't see an arrow that shows all the @AuraEnabled variables on the left to select the variable.
Now how do I access the individual fields of the collection variable on a screen component. The collection variable should be pointing to three fields as shown below and I need to send the 3rd variable to a LWC component as well.
@AuraEnabled @InvocableVariable(required=true)
public Boolean errorOcurred;
@AuraEnabled @InvocableVariable(required=true)
public String errorMessage;
@AuraEnabled @InvocableVariable(required = true)
public List<Result> customerAccountContacts;