Application Studio - which event should the input validation be tied to for PO Approvals?

We are about to start using the PO Approval functionality in Epicor but need to add checks to make sure the user doing the approving is neither the Buyer nor the person who created the PO. This is my first time using events in App Studio and I’ve been struggling with this so I hope someone can help.

I created a new event ce_BeforeBeforeUpdate which is triggered before the BeforeUpdate event. The first condition checks that the Buyer in the APV dataview (APV.MsgFrom) is not the same as the approval person (APV.DcdUserID).

The second condition checks that the person who created the PO (APV.EntryPerson - this field has been brought in from POHeader via a BAQ and matched with the APV dataview, thanks to @hmwillett for instructions on this here) is also not the same as the approval person.

These checks seem to work as required and produce an error if the user is the buyer or entry person. The problem is when the user is neither and therefore should be allowed to approve/reject the PO. However, the Action field is reset to blank and I get the message “You must Accept or Reject the PO.”.

I’ve tried using other events as the trigger but get the same results. How do I keep the selected value in the Action field after the 2 conditions or should I use a different event as the trigger?

I hope this makes some sense & thanks for any assistance.
Alison

Honestly, I wouldn’t even consider using App Studio for this.
Throw the checks on a BPM so it’s handled server-side; it would be much cleaner.

4 Likes

Thanks Hannah, you’re right. I couldn’t see the woods for the trees!

1 Like

Evil Dead Scream GIF by ALTER – The Best Horror Films

^ App Studio Trees. :smiley: