/**
 * @description Apex class to retrieve Account names using invocable method for Flow
 * @author Aksh Desai
 * @date 2025-02-18
 */
public class AccountAction {
    /**
     * @description Invocable method to get Account names from a list of Account IDs
     * @param ids List of Account IDs to query
     * @return List of Account names corresponding to the input IDs
     */
    @InvocableMethod
    public static List<String> LightningStudio(List<Id> ids){
        // Initialize list to store account names
        List<String> accountNames = new List<String>();

        // Query accounts and add their names to the list
        for (Account acc : [SELECT Id, Name FROM Account WHERE id IN :ids]) {
            accountNames.add(acc.Name);
        }
    
        return accountNames;
    }
}