Error messages been generated during the script execution are often not very useful.
Most likely purchaseOrder is null, but I’d correct this one first:
[purchaseOrder : purchaseOrder]
to
[_purchaseOrder: purchaseOrder.id]
and so the id key value of the request will be: $_purchaseOrder
Also please take a look at this one:
Working BPM script example