Dany,
The `playbook` object will only be defined in scripts when the whole playbook runs.
It looks like you may have ran the script with the 'Run' button when creating it?
If you trigger the playbook then that script should work fine. Anytime you have a script that uses the playbook object you'll have to trigger the whole playbook to test it. You won't be able to use that run button. I'm hopeful there's a better solution than this that I don't know about.
Hope this makes sense. Let us know if I'm wrong about my assumption with the run button.
------------------------------
Liam Mahoney
------------------------------