I want to fetch message id of the document. I tried
document.getItemValueString("$MessageID");
but it's giving null.
Check out this thread from the Notes forum. You may need to follow the advice there, which is to set the saveMessageOnSend property to true before sending and then obtain the $MessageID
from the copy of the document that is saved back to the mail database.
Otherwise, you may need to add a tilde before the dollar sign:
document.getItemValueString("~$MessageID");