How to set field value with beforeload userevent script?

I want to setValue on the transaction body field for existing records, that values come from query results. I tried with userevent beforeLoad function but not worked. is this scenario works with userevent beforeload script?