Here’s a script we had in the app previously:
tell application "Notes"
activate
set noteID to «class seld» of ((make new note with properties {name:"$title"}) as record)
set noteID to text 14 thru -1 of noteID -- "x-coredate://noteID"
get "notes://" & noteID
end tell