Issues with REST, marking Pack Slip Ready to Invoice

Just by curiosity, have you tried to put your logic in an Epicor Function AND calling it from REST AND make sure your logic contains a Before Image (@josecgomez code below )?