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 )?
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 )?