The below script would do it but unfortunately, Scriptable does not have permission to access the note field on iOS 13. The notes of a custom have become a field that Apple needs to approve in order for apps to use it. I will send a request to use it but I think the chances are slim that Scriptable will be allowed to use it.
let containers = await ContactsContainer.all()
let contacts = await Contact.all(containers)
contacts.sort((a, b) => {
return displayName(b) < displayName(a)
})
let table = new UITable()
for (contact of contacts) {
let name = displayName(contact)
let row = new UITableRow()
row.dismissOnSelect = true
row.onSelect = (idx) => {
let c = contacts[idx]
edit(c)
}
row.addText(name)
table.addRow(row)
}
table.present()
async function edit(contact) {
let alert = new Alert()
alert.title = "Enter Note"
alert.addTextField("Note", contact.note)
alert.addAction("Save")
alert.addCancelAction("Cancel")
let idx = await alert.presentAlert()
if (idx != -1) {
let note = alert.textFieldValue(0)
log(contact.givenName)
log(note)
contact.note = note
Contact.update(contact)
Contact.persistChanges()
}
}
function displayName(contact) {
return contact.givenName
+ " "
+ contact.familyName
}