The following video demonstrates my process when dictating/transcribing a melody in a small number of hearings:
Get oriented to tonic, mode, meter, counting pulse.
Memorize as much as possible.
Transcribe what I remember after the first hearing before I forget it (usually beginning and end).
Note any repetition patterns that can make it easier to figure the rest of the melody.
Listen again, and try to memorize the whole thing.
Transcribe everything I remember.
Repeat the last two steps as necessary.
Use one last listening to check for errors, paying special attention to rhythm, durations, and rests.
Melodic dictation (demo) from Kris Shaffer on Vimeo.