OK I have looked at all of the topics on how to do this and can’t get it to work. As the title says, I want to make sure the part number is upper case. So, from reading, it sounds like there are multiple ways to do this:
Form event - Part_BeforeFieldChange
Data directive - In-Transaction directive on the Part table
Method directive - Pre-Processing directive on Erp.Part.ChangePartNum
It seems like method #3 above is the preferred way of doing this (from here so that is what I am trying. So I created a Pre-Processing directive on the Erp.Part.ChangePartNum and entered the designer and added a ‘Set Field’ widget. I set it to this:
'Set the ttPart.PartNum field of the updated row to the expression: BpmFunc.ToUpper(ttPartRow.PartNum)
And… it doesn’t work. I validated, saved, and closed Epicor and it does not work on the Part form. What am I missing?
Another vote for no.2 method here, which is what we use to do exactly this.
A couple of points - the thread you mention deals with screen customization, and if you’re wanting to force all NEW parts to upper case then you need to catch added rows rather than updated ones.
Another vote for #2. in-trans, added row, partnum.ToUpper(). If by chance you have some code generating part numbers on GetNew then put the ToUpper there.
Please do not use BpmFunc those are helper methods created for writing ABLSharp( Aide those ABL users to transition, but the functions are usually implemented in pretty awful ways). Use the .net equivalent of that which is .ToUpper();
Set the ttPart.PartNum field of the changed row to the expression: ttPartRow.PartNum.ToUpper()
Also the reason it doesn’t work is likely cause you are using “updated row” you should change that to ChangedRow (Updated or Added)
Ok well I tried a data directive and it worked! Basically the same expression so not sure why it didn’t work in the method directive, but it sounds like this is maybe the better solution anyways. So here is what I did:
Note that I used the default ‘BpmFunc’ version of the function since that is what was supplied. I didn’t try just the .Net ‘ToUpper’ so I don’t know if that would have worked also.
Anyways, when I enter or update a Part:
Then save it, it capitalizes the part number:
So I am happy. I think I will also perform this same task on the description as well.
Thanks to all that replied - it is much appreciated!
Jim
There is a fringe reason in Part Entry that the method directive did not work. In a lot of cases what you did should work fine, but Epicor does some goofy stuff with new parts and local variable stores in the form screen itself on Part Entry.
It has to do with the Lookup vs New feature of that field. If you type some random SH*T into the partnum field Epicor does a lookup to see if it can find it and if it doesn’t it prompts you (new?)
That logic first temporarily holds on to the typed value in a local variable which they then put right back on the textbox regardless of what the method did… (Crappy logic if you ask me) but alas that’s why it didn’t work.
If anyone want’s to fart around with it the variable is oTrans.newPartNum they store the value there, then after GetNew is settled in they set tbPart.Text = oTrans.newPartNum it’s silly.
So making a new part with part maintenance can be done two ways (actually 3, maybe more)
With a cleared Part Maintenance form, type the desired Partnum into the field and hit tab. Like @josecgomez said, a lookup will occur to see if it exists. If it doesn’t, your prompted to make a new Part.
In Part Maintenance form, select New -> Part.
Does the state of the ttPart record vary with which of the above you used? Do both call the same BO? (I assume #1 calls some extra BO’s based on the lookup and retrieval if a match is found)
The third way that came to mind was using Actions -> Duplicate Part.
Obviously a Data Directive would catch any of these. But if your required customization was more than just forcing the PartNum to UPPER case, you might need a Method Directive. Or more than one.