use record.id instead of record.ids[0]