Automation Email - inserted grid - date order issue

Topic Labels: Admin Automations Community
866 4
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Aweome Airtable Community. 

Please could you help me understand what I am doing wrong or enlighten me as to why this is happening?

I have attached a sample of the Automated email that is sent to our client with a copy of all their appointment in a grid.

The issue is that the appointments do not show up in the correct date order for easy checking, and we have had complaints.

Why does this happen?  Is it using a different field so sort the appointments?

Thank you in advance for the advice and help






4 Replies 4
8 - Airtable Astronomer
8 - Airtable Astronomer

Hi @Terri_Martin, you would need to use the scripting extension for this. This thread has a good example for you -


5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you very much 🌟

Hi! Did you ever solve for this? Did you build a script? Struggling over hereeeee lol

Once I sorted out the Record ID Variable, it seemed to work but I still get some lines out of order.  At the moment I am using this code - 
// get recordId that triggered automation from
// input variables
let recordId = input.config()['recordId'];

// Change this name to use a different table
let peopleTable = base.getTable("ClinicianMonth");

let registrationsTable = base.getTable('Appointments');

// Prompt the user to pick a record 
// If this script is run from a button field, this will use the button's record instead.
let record = await peopleTable.selectRecordAsync(recordId)

    // get cell with linked records 
    let linkedRegistrations = record.getCellValue('Appointments');

    if (linkedRegistrations) {

        for (let registration of linkedRegistrations) {
            // get the full linked record info
            let registrationRecord = await registrationsTable.selectRecordAsync(;

            registration['date'] = registrationRecord.getCellValue('Start time')

        // sorts list by date from earliest date to latest date
        linkedRegistrations.sort((a, b) => ( > ? 1 : -1)

        // remove the added date attributes after sorting
        for (let registration of linkedRegistrations){
            if ( {

        // output.inspect(linkedRegistrations)

        await peopleTable.updateRecordAsync(
                Appointments: linkedRegistrations