How To Change an Epicor ERP Customization
Into a Different Programming Language

 

Who’s ever inherited a Customization that was created in the “wrong” language? I certainly have. They’ve usually had a lot of user interface changes and little or no custom code.

Now, who’s to say it’s the wrong language? Well, as the person with the responsibility to write custom code, that would be you. For me, the wrong language is VB.NET. The correct language is C#. You may feel differently, but that just makes you wrong too. But hey, to each their own.

The problem is that once a Customization has been saved, the Epicor system won’t let you change the language.

If you find yourself in this situation, a couple of options come to mind:

  • Use the existing Customization and write code in your less favored language. If you’re fully fluent in both C# and VB.NET, then just go and do your rockstar thing.

  • Create a new Customization, selecting your favorite language when you create it – then modify that Customization, knitting in the UI changes from the original.

 

But, Is That Your Only Option?

There is another option. You can export your Customization and modify the XML in your favorite text editor.

There are two nodes that you can modify to change the language used in the customization. Those nodes are “Language” and “Script.” You’ll need to find these nodes and modify their corresponding PropertyValue.


Depending on the language being used, they look like this:

 
<PropertyName>Language</PropertyName>

<PropertyValue>VisualBasic</PropertyValue>
 

And like this:

 
<PropertyName>Script</PropertyName>

<PropertyValue>'//**************************************************

'// Custom VB.NET code for SalesOrderTrackerForm

'// Created: 4/2/2012 2:28:06 PM

'//**************************************************

Imports System

Imports System.Data

Imports System.Diagnostics

Imports System.Windows.Forms

Imports System.ComponentModel

Imports Microsoft.VisualBasic

Imports Erp.UI

Imports Ice.Lib.Framework

Imports Ice.Lib.ExtendedProps

Imports Ice.UI.FormFunctions

Imports Ice.Lib.Customization

Imports Ice.Adapters

Imports Erp.Adapters

Imports Ice.Lib.Searches

Imports Ice.Lib

Imports Erp.BO

Imports Ice.BO

Imports Erp.Proxy.BO

Module Script

     '// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **

     '// Begin Wizard Added Module Level Variables **

     '// End Wizard Added Module Level Variables **

     '// Add Custom Module Level Variables Here **

     Sub InitializeCustomCode()

          '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **

          '// Begin Wizard Added Variable Intialization

          '// End Wizard Added Variable Intialization

          '// Begin Custom Method Calls

          '// End Custom Method Calls

     End Sub

     Sub DestroyCustomCode()

          '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **

          '// Begin Wizard Added Object Disposal

          '// End Wizard Added Object Disposal

          '// Begin Custom Code Disposal

          '// End Custom Code Disposal

     End Sub

End Module

</PropertyValue>
 

Changing the Programming Language & Importing the Customization into Epicor


In this case, we wanted to change the language from VB.NET to C#.

To do this, we replaced “VisualBasic” with “CSharp”.

We also replaced the VB code with our own C# code.

Save the XML file.

In Epicor, we opened the form in Developer Mode. Instead of selecting the Customization, we deleted it. Then we imported the modified XML file and selected it.

Next, we opened the customization. The Script Editor now shows C# is our language, it’s using our code, and it compiles!

If you don’t have any code that you want to use, you can just clear all the code from that PropertyValue node. Epicor will generate the required stock code when you first open your customization.

If you don’t clear the existing code, which is now going to be considered by Epicor the “wrong” language, you’ll get the following error when loading the Customization.

Epicor ERP screenshot describing how to change the customization programming language

If this happens, go ahead and open the Customization in Epicor, go to the Script Editor and delete all the code, save and close the Customization. You’ll also need to close the form. Reopen the form and the Customization. Check the Script Editor and you’ll see that Epicor has stubbed out the basic stock code for the language you targeted.

Save your xml and it’s ready to be imported!

Have fun!