BPM management

Happy Friday!

Do any of you have any tips on general organization of your Epicor BPMs?

I’m re-working our internal management of the system after years of neglect.

As an example,

For some reason previous developers decided to hard code all of the US states into a list. Or they hardcoded in certain integration systems to exclude from the BPM logic for some reason.

Any way, now I have to manually go through numerous method and data directives just to either add or remove a string of text.

Why the previous people hard coded these in when we have user tables in Epicor? I have no idea.

I’m guessing the best solution is to move all of these “magic strings” into the ICE user framework tables. Then reference the same tables in all effected bpms.

Such a chore. No comments , hard coded values. I have my work cut out for me.

Ok, rant over :wink:

What I find is that developers start to hard code when they have to meet deadlines.

If they are not references, just string, I guess you can change them quite easily. Maybe consider using UserCodes.

https://www.brainyquote.com/quotes/napoleon_bonaparte_108864

“It was hard to write, so it should be hard to read.”
~ Old programmers saying

I am guilty of hard coding strings that I know will be changed in the future. I have code in a data directive’s custom code block that includes a string of email addresses to be CC’d on a generated email.

How would one go about storing this some other way? A user defined code, with its ID as something that indicates where it’s used (a shipping notification in this case) and the list of CC’d emails as a single string for that code?

Yep - I use UserCodes for all these lists of items. Lists of departments, list of lid colours, list of sample types etc etc.

I have a UDCodeType called AutoNumber, and then the UDCodes under that are per the table they relate to. You could have a Code Type called EmailCCs and then each UDCodes representing the BPM it’s used in.

3 Likes

How do I retrieve a UD code value to use in a Custom Code block?

This is one that I use for AutoNumbering. I cut out the bits that you don’t need, you may have to make a couple of tweaks.

Ice.Tables.UDCodes UDCodes = null;

using (var txScope = IceContext.CreateDefaultTransactionScope())
{
	foreach (var MyUDCodes in (from ThisUDCodes in Db.UDCodes.With(LockHint.UpdLock) where
		ThisUDCodes.Company == Session.CompanyID &&
		ThisUDCodes.CodeTypeID == "AUTONUMBER" &&
		ThisUDCodes.CodeID == "ENGPART"
		select ThisUDCodes))
		{

			int NextEngPartID;
			int.TryParse(MyUDCodes.CodeDesc, out NextEngPartID);

			MyPart.PartNum = "ENG" + NextEngPartID.ToString();

			NextEngPartID += 1;

			MyUDCodes.CodeDesc = NextEngPartID.ToString();

		}

		Db.Validate();
		txScope.Complete();
	}

}
2 Likes

Thanks for the input everyone! That UD code is very nifty forsure.

Another question,

In terms of performance, does anyone know which is more expensive? Method or data directives?

I would say DD’s are more expensive since they are called more often. The Method directive allows you to pinpoint the BO/Method to target, sniper-style. Perhaps a back end guy could confirm this.