This can be done easily at the end of a meditation or upon waking while still in the dream state.
I have found the best time for me is 3 - 4 am. I wake up and start writing whatever comes. When I feel done, I go back to sleep.
Sometimes it is hard to believe I wrote what I later see.