function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jacob Elliott 8Jacob Elliott 8 

LWC- Sort Records Returned By Wire Service To Be Used By Child Components

Hello All, I'm trying to create a parent component that uses wire service to grab task records and then sorts them into two maps(?) to be consumed by child components. I need them sorted by Status = Completed or Status != Completed.

I'm having trouble figuring out how to iterate over the returned records.

Any help would be greatly appreciated!

public with sharing class ATLController {
    public static List<Task> getTasks(String recordId) {
        return [SELECT Id, Subject, TaskSubtype, ActivityDate FROM Task WHERE WhatId = :recordId];
import { LightningElement, api, wire } from 'lwc';

export default class AtlBase extends LightningElement {
    @api recordId;

    completedTaskList = [];
    upcomingTaskList = [];

    @wire(getTasks, {recordId:'$recordId'}) 

        for(let task in tasks){
            if(task.Status === 'Completed'){
            } else if(task.Status != 'Completed'){

Best Answer chosen by Jacob Elliott 8
Check this -