Accessing Database Field in Script Editor

Hello, I’ve got a part adapter set up already but I don’t know how to use it to access a database field. Specifically I’m trying to check the Part.TypeCode db field to check if it is manufactured and if so trigger a message that tells the user the part is manufactured in a purchase order entry.
Essentially click Part/Rev, select a part, and if it is manufactured then to display a message box for example.

I’m a new user and would appreciate tips

Use the Data Tools to add the Part table as a foreign key view. You can then add any field in Part to a control on your form and it will update (i.e. grab the new part record) when the parent row changes.

Though, you’re being kind of vague as to what you’re doing here. If this is going to be actual biz logic, you want to put that in a BPM. Client-side code should just be for appearances.

Apologies for the vagueness, I’ve updated the original post for a better idea.

Yeah, you want to put that in a BPM. Whether you want it in a pre-proc BPM (where you can stop the user from adding the part) or post-proc (where the system has accepted the value and you just want to show a pop-up message) is up to you.

BPM method is Erp.BO.PO.ChangeDetailPartNum, as indicated below.

Literally cooked this up in 60 seconds with zero code. Haven’t tested it, but 99.9% sure it will work. Only reason it wouldn’t is if ChangeDetailPartNum is weird.

image

image

1 Like

Given where Epicor is moving us I would not do any logic in custom code. Full disclosure I rarely did even back in E9, so I always go with a bpm first.

Post processing on PO.ChangeDetailPartNum you can add the message and it is future proofed.