Create a central code repository to allow code sharing within the Application

Central Code Repository: Instead of custom client DLLs, allow users to upload shared code to one place and then have that code be callable by BPMs or Configurator Methods. This promotes the DRY principle - Don’t Repeat Yourself. Have the code stored in one place, it’s audit-able, it can be source-controlled, and easier to upgrade since it can be reviewed with automation.

6 Likes

This one is a complicated one but let’s just focus on BPMs right now.

If we could Create a Shared Code Location even if its for the time being Lambdas/Funcs/Actions and Reference it in the BPMs like-so Ice.ExecuteSharedFunction(“YourGistName”, [ Array of params ]); or even have the Compiler In-Line it. Support Shared LINQ Expressions.

Atleast we can Maintain it at 1 location instead of Duplicating it.

Stuff Like:

// Initialize Logger
string LogFile = "";
Action<string> log = (m) =>
{
    if ( !string.IsNullOrEmpty(LogFile) ) {
        Ice.Lib.writeFileLib.FileWriteLine(LogFile, string.Format("{0} - {1}", DateTime.Now, m));
    }
    else {
        Ice.Diagnostics.Log.WriteEntry(m);
    }
};
 
// Initialize Helpers
Func<string, string> CleanFileName = (fileName) => {
    return System.IO.Path.GetInvalidFileNameChars().Aggregate(fileName, (current, c) => current.Replace(c.ToString(), string.Empty));
};

// You could of course Func a Query in

This seems very similar to this other suggestion: Create a central code repository to allow code sharing within the Application - Feature Requests and Suggestions - Epicor User Help Forum

1 Like

Ah howd I miss it, Maybe @josecgomez can merge it

done

A friendly bump - this does not have enough votes!

In the use case I am thinking of right this moment, I have several little features\functions I use on many of my customs. An example is a way to store and display a version number in the caption - I am sure most of you have been in the situation where you are wonder what version of a custom is loading for a user. Instead of having to finagle every custom I start, if I had this global code base I could access, it would make it much easier to implement something like this and many other time savers.

I would note the global code should get a context passed into it, so you could write funcs to affect the caller.

1 Like

DRY - Don’t repeat yourself!

LOL

But you’re right @Chris_Conn. Imagine having some well-tested code that can be used by BPMs, Configurators, Directives, etc. If you change it in one place, it’s changed everywhere. It would make staying current so much easier.

2 Likes

I have done this via UBAQ write a UBAQ that performs some function then invoke that UBAQ from Customization or BPM or REST

Granted this is a hack

1 Like

Any port in a storm I say - creative solutions are acceptable in my book. The biggest drawback I see with that is not having the context of the caller (really a pointer to the caller - particularly in the case of a form)

1 Like

UBAQs have callcontextclient and bomdata

Ah so you are saying pass the form in thru call context?

It passed automatically via callcontrxfclient

Really?! Like the form as an obj? I just learned something.

Lol not the whole form just which form

General note - is this satisfied by Epicor Functions?

This is very big. No doubt. We cross the line when Product Configurator joins the club. :wink:

Yes, I think this qualifies, specially if / when functions can be called Ubiquitously throughout the application (Customizations, BPMs, Rest, Configurator, BAQs)…

1 Like

Cool! Functions I am told - I was not heavily involved in them to date but getting there - are available today in BPMs. They are definitely available in REST. For customization’s they are technically available in 10.2.500 but its a bit of rocket science. In 10.2.600 a helper component has been provided to make it much easier - provide your session data, select your service and off you go making rest calls. Primarily for functions but will allow general E10 rest calls from the client.

For BAQs - how do you view their use? Calculated columns? Part of the update process logic (there secondarily as those are BPMs which can call functions).

Configurator - I’ll have to check - I’m hoping the REST calling helper will be available there but I will have to look into it.

1 Like