You need to sign in to do that
Don't have an account?
Salesforce P1
query records using collection in flow
Can we query using a collection variable in conditions to fetch records in Flow.
Eg: i have a collection of Accounts. Now i need to fetch latest case on each of these accounts . Kind of IN:= accountids scenario in SOQL
Eg: i have a collection of Accounts. Now i need to fetch latest case on each of these accounts . Kind of IN:= accountids scenario in SOQL
Greetings to you!
Please refer to the below link which might help you further with the above requirement.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_designer_example_loop.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
You can try this snippet of code for fetching latest cases.
I have checked it on my Org.
1. First I had created a list of account in DESC (so our list of the case come in latest case).
2.Transfer Id of those account in the set.
3. And fetch Case based on the set of Id.
List<Account> accountList = new List<Account>();
accountList = [select Id ,Name from Account ORDER BY Name DESC];
Set<Id> idSet = new Set<Id>();
for (Account acc : accountList){
idSet.add(acc.Id);
}
List<Case> caseList = new List<Case>();
caseList = [select Id,CaseNumber,Account.Name from Case where AccountId =: idSet];
System.debug('caseList--->'+caseList);
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha