We have a bunch of ShipVia we no longer use. Bossman wants them removed from the list to select. Is there a way to do this? I don’t see an archive or inactive flag on the ShipVia.
You could add a UD field InActive and then put a BPM on ShipVia.GetList() method to filter those out (This is the method that gets called 99.9% of the time from any system dropdown regarding ShipVia)
A way to do this without a UD Field is to simply add “ZZInactive” to the beginning of the ShipVia Description field (leaving the rest of the description alone)… This step moves all those items to the bottom of the list… THEN you can further filter as @josecgomez suggested all the items that have “ZZInactive” as the start of the description.
OK… this was too tempting for me not to try… I have been experimenting with doing many BPMs with just widgets… doing the traces… following the tracks… then creating the BPMs.
This is TOO EASY once you understand what to do… note that this technique should be usable on ANY GetList… not just ShipVia.
Here are the steps for you to recreate.
- Create a new METHOD BPM in ShipVia GetList as a PRE-PROCESSING BPM
- add a new “Set Argument/Variable” widget
- change it to say "Set the whereClause argument/variable to the specified Expression
In the specified expression, enter the following line of SQL code (including double and single quotes).
"Description not like 'ZZInactive%'"
Save and activate the BPM… THAT IS IT… the whole enchilada… All I had to figure out was the SQL Syntax, and I learned that by searching the internet (google: “Sql string does not start with”)
Now, anyplace that has a combobox list for ShipVias (which use the GetList function) will automatically hide the entries that begin with ZZInactive in the description (or ZZ or anything you choose to make it).
Also… if you choose to add a UD Field for inactive, you could change the whereClause to meet your needs.
Tim - Good stuff! Can’t wait to try it. We’ve got quite a few fields where something is no longer used, but Epicor wants to hang on due to transactions against it…
Thank you Tim! I was looking for a way to do this yesterday and this BPM solved that so easily!
Since most cases, these tables allow the changing of the DESCRIPTION, even if there is not another “Active/inactive” flag, you can use this technique fairly easy with no big coding change.
ALSO… if you want to get “fancy” with this BPM, you could put a condition in that it does NOT filter if you are in the IT Department (Just in case you want someone to still get to the data).
Yes Tim, you beat me to it!
I’ve done that before for other things, glad someone else has brought up another use case.
I did this on a Per user basis for the Shop Tracker so the supervisor would only see the resources he oversees.
The only thing I don’t like about it is it’s invisible and can confuse others if they don’t know the BPM is there.
Bookmarking this one for in the future!
Very nice, i wonder though if there are any instances where the WhereClause may already have criteria that gets overwritten. In that case we’d need to append to it.
Yes, there could be conditions that are already in use… you can see what is normally sent through running a trace. If it is already there, then you would need an “and blablabla” to make it work.
I have no other words. Thanks Tim.
Hi Tim - This is great and I started using this. I recently found out that the way you have this setup will prevent the Tracking buttons from working in Customer Shipment Entry, Subcontractor Shipment Entry, and Subcontractor Shipment Tracker as the Tracking buttons use the GetList method. This is not a problem with Customer Shipment Tracker as the Tracking buttons use the GetByID method instead. I have figured out how to adjust your BPM using the Execute Custom Code with a simple if statement. This has use Synchronously as it would not work Asynchronously. The code is below along with a screenshot like you did. You will notice that I used ZZZ- as my prefix instead of ZZZInactive.
if ( String.IsNullOrEmpty( whereClause ) )
{
whereClause = “Description not like ‘ZZZ-%’”;
}
Pete Chikes
@timshuwy - Can this work when the description isn’t editable?
We’d like to hide the Billing Types that aren’t used in Order Entry.
Since it’s a system table, EpiCare support said it wasn’t possible for me to edit them. I figure I should be able to hard code the unwanted billing types in the whereClause…
Thanks!
Since the descriptions cant be changed, you could feel safe in hard coding the WHERE clause to explicitly use the descriptions you want to filter out.
But what ive done more often is to add a UD field named Inactive_c
, and set the Where clause on that.
I have added the custom UD Inactive field in Customer Price List. But how to usee Inactive_c in where clause?
The Set Argrument/Variable Widget, returns a value to which the arg (or variable) you selected, will be set to.
Just make the expression:
"PriceLst.Inactive_c = FALSE"
Here’s the PreProc MD BPM we use for limiting the PartClass
I wish I had named the UD Column Inactive_c
- to keep with Epicors convention - but actually went with AllowUsage_c
, which then requires the opposite condition (TRUE, vs the FALSE used with “InActive”)