Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Airtable automation script to sort linked records by date: Earliest to latest

Topic Labels: Automations
470 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Ricardo
7 - App Architect
7 - App Architect

Hi community, I have set up a trigger that loads a record and passes on linked records values to a script supposed to order those by date from earliest to latest. I'm struggling to get this to work, can anyone advise? Thanks!

const inputConfig = input.config()
const linkedRecords = inputConfig.linkedRecords

linkedRecords.sort(function(a,b) {
  var c= new Date(a.date).getTime();
  var d= new Date(b.name).getTime();

  return c-d;
})

output.set("linkedRecords", linkedRecords)

 

0 Replies 0