Auto-calculate Sales Comms

Uploading blob.png…

I am trying to write a script to auto calculate the sales commission for each sales person when created Sales Order. However, I can’t seem to make the fields perform the calculation by using Custom Script.

Anybody can give me some hint on where to start? Trying to get allocated_amount x comms_tier = total_comms_due