Since you cannot delete a Part Class once it has been referenced, I needed a way to set Part Classes as “inactive”, so they would not be used in the future.
I did this by adding a boolean UD field “AllowUsage_c” to the PartClass table, and customized the Part Class Entry screen, to add a checkbox for that UD field. Then Customized the Part Entry form, adding filters to the Part Class dropdown control to remove PartClasses whose AllowUsage field is not set. This doesn’t really prevent it from being assigned (I’ll make a BPM later for that), but prevents people from selecting here.
So my question is… How can I find out which forms the Part Class can be selected on? So that I can customize those to do the same filtering trick I did on Part Maintenance.
I know it is also on the PO Entry form. I don’t mind if it is selectable as a search/filter criteria (like on the Stock Status Report). I just don’t want someone to select it to be used for a record like Part or PODetail.
One all-encompassing way of doing this is a BPM on GetList. You can set the whereClause to what you like, then what gets returned to any dropdown control anywhere is already filtered. We do the same thing in a couple of places.
It’s VERY straightforward, though introducing context sensitivity might make for a bit of complication.
All we do is add a pre directive and manipulate the “whereClause” variable, which is a built-in one and acts exactly like the SearchFilter in form customization. For future-proofing it’s a good idea to assume there might be something already in there, otherwise it’s one widget to set to what you like. I assume you could test for something in a conditional as usual if you wanted to vary it - we haven’t needed to so far.
One other workaround is that I think it doesn’t apply if you set the dropdown to GetRows instead of GetList, so you could possibly do that in any forms where you wanted the whole lot.
We use the “AND” form, as per the form SearchFilter field rather than the filter list. And single quotes within the overall double-quoted string. Basically a SQL “where” as a string expression.
Setting the WhereClause (using a Set Argument/Variable widget) to:
"(PartClass.AllowUsage_c = TRUE)"
works as expected. Only Part Classes with that UD field set are returned.
.
While setting it to
"(PartClass.ClassID = 'BFIL')"
passes the syntax check and the BPM can be saved. But initiating a GetList yields the error:
Error accessing the database:
The multi-part identifier "PartClass.ClassID" could not be bound.
Details show
Server Side Exception
Error accessing the database: The multi-part identifier "PartClass.ClassID" could not be bound.
Exception caught in: Epicor.ServiceModel
Error Detail
============
Description: Error accessing the database: The multi-part identifier "PartClass.ClassID" could not be bound.
Program: System.Data.dll
Method: OnError
Original Exception Type: SqlException
SQL Line Number: 9
SQL Error Number: 4104
Yes - but in case anyone does put anything in the whereClause and wonders why it doesn’t do anything, there’s a conditional checking if it’s blank or not. If it isn’t, it does this. I could have shown the other one, but it didn’t have an “AND” in it.
@ckrusen I see this turned out to be an XY problem, but did you ever find a solution to your original question? I’m thinking about cleaning up some unused UD columns. I know how to search for references in BPMs, but not in UI customizations.