You need to sign in to do that
Don't have an account?
Varun MK
The Data Type of the resource you entered doesnt match
I have an Apex Class that returns the Count of Number of times a User Logs into an Org. Further, this Apex class is called from a flow.
I am facing trouble when I am calling this Apex class in the Flow. I have attached the SS's.
While choosing the output parameter,
#Flows #Apex
I am facing trouble when I am calling this Apex class in the Flow. I have attached the SS's.
While choosing the output parameter,
- What should be the variable choices ? simple variable or collection variable ?
- What should be the Data Type ?
- I am getting the error attacehd as "The Data Type of the resource you entered doesnt match"
- How can I Test this flow, it is intended to create a record and disable a user.
----------------------Apex Class:-------------------------------------- public class UserLoginCount { @InvocableMethod public static List<List<Integer>> CountOfUserLogin(){ List<AggregateResult> lstSession = [SELECT COUNT_DISTINCT(LoginHistory.UserId) totalCount FROM AuthSession WHERE LoginHistory.UserId=:UserInfo.getUserId()]; Integer countOfLogin = lstSession.size() > 0 ? Integer.valueOf(lstSession[0].get('totalCount')) : 0; List<Integer> authSes = new List<Integer>(); authSes.add(countOfLogin); List<List<Integer>> wrapList = new List<List<Integer>>(); wrapList.add(authSes); System.debug('Count'+wrapList); return wrapList; } } -----------------XXXXXXXXXXXXXX--------------------------------------------
#Flows #Apex
Inputs and Outputs
- There can be at most one input parameter and its data type must be one of the following:
- A list of a primitive data type or a list of lists of a primitive data type – the generic Object type is not supported.
- A list of an sObject type or a list of lists of an sObject type – the generic sObject type is not supported.
- A list of a user-defined type, containing variables of the supported types and with the InvocableVariable annotation. Create a custom global or public Apex class to implement your data type, and make sure your class contains at least one member variable with the invocable variable annotation.
If the return type is not Null, the data type returned by the method must be one of the following:Change your class as below and pass the list of user id from the flow
Could you suggest how I can test my flow? I was able to create a Collection variable with Number as the Data Type.