Skip to main content

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)

 

Be the first to reply!

Reply