Monday, April 11, 2011

Epicor 9 and User Defined Codes

When customizing Epicor 9, you might find you require additional fields for a given table.

For example, we have a client who organizes sales regions into sales districts. So, on the Sales Region Maintenance screen, we want the user to be able to select a district.

BEFORE


AFTER



You can customize the form, by adding a TextBox for SalesRegion.Character01 field, but it is better to have the user select from a range of choices.

Previously to accomplish this, you would have to add the sales districts into a user-defined table, and then add a combo box which populates from that table.

The easier way is to use something called User Defined Codes Maintenance.

Step 1 - Define User Codes

Located under System Management -> Utilities -> User Codes, open the "User Defined Codes Maintenance screen".

Create a Code Type, and then assign values (Code, and Code Description). In my case, I created a Code Type called "District", and added 4 codes, with descriptions "Northern District", "Southern District", etc. Each code also has a shorter Code ID.

Step 2 - Associate Field with User Code
Located under System Management -> Utilities -> Extended Properties, open the Extended Properties Maintenance screen.

In my case, I want to associate the district codes with the sales region:

  1. Selected "Region" DataSet Table ID
  2. Selected Fields tab, and selected the Character01 field from the tree view
  3. for the UD Code Type: field, chose "District" from combo box.


Now the system knows that Region.Character01 is associated with User Defined Codes "District".

Step 3 - Form Customization
Now I need to add to the Sales Region form a combo box for the Character01 field.


  1. Turn on Developer Mode (Main Menu -> Options -> Developer MOde)
  2. Open Sales Region
  3. Start Customization (Tools -> Customization)
  4. From Toolbox, add a EpiCombo control to the form
  5. Change the EpiBinding property to Region.Character01


As soon as I select Region.Character01 for the EpiBinding property, the system automatically filled in for me the EpiCombo properties.




And that's it. Now your users can choose from a pre-defined list of values for a user defined field.

8 comments:

  1. I was following this guide and everything was fine until Step 3. Searching EpicWeb, found this extra tip to make it work:

    If you experience issues with the combo box not populating correctly and are running Epicor 9 on a SQL server then try the following. Be sure that you have created the User Defined Codes, added the Extended Property, exited Epicor 9 and are adding the combo as a "new" control to the form. If it still does work then try restarting the app server and then add a new combo box to your customization.

    ReplyDelete
  2. Just wanted to say thanks for writing this up! I was creating the combo box first and then doing the rest and Epicor was not linking it up at all.

    ReplyDelete
  3. Is it possible to allow users to update this list in the form itself?

    ReplyDelete
  4. The epicombo list can be updated at anytime by using the right click -> Refresh list option.

    ReplyDelete
  5. Is it possible to access the udcode's id or code in the customized screen, but view the description in the drop down?

    For example choosing say 'eastern region' from the combobox, then populate a textfield in the screen with the codes id, ie 1?

    something like epicombobox1.value?

    ReplyDelete
  6. this post has resulted very useful for me

    greetings from mexico

    ReplyDelete
  7. this post has resulted very useful for me

    greetings from mexico

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete