# Best place to put global variable (UDField)

**URL:** <https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601>\
**Category:** Epicor ERP 10\
**Tags:** epicor-customization\
**Created:** [December 10, 2019, 4:32pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601 "2019-12-10T16:32:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexbg89](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@alexbg89](https://www.epiusers.help/u/alexbg89)\
**Post date:** [December 10, 2019, 4:32pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/1 "2019-12-10T16:32:22Z")

</div>

Hi Everyone,

I’m new to Epicor so sorry in advance if I don’t make any sense. I am still in the process of learning the software and the learning curve is a good one. I wanted to know where would be the best place for me to store a Global Variable. I want to assign UPC code has the new part is created and needs to store the last one used somewhere. I know that I could simply select the last one used directly from the part table but is there anywhere else I can store some global variable.

I will also need to store some api key for various integration and I will probably have to use a global variable as well.

Thanks in advance for your help!

Alex

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [December 10, 2019, 4:35pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/2 "2019-12-10T16:35:23Z")

</div>

You could use a User Defined field on a table.

---

<div class="post-metadata">

**Author:** ![alexbg89](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@alexbg89](https://www.epiusers.help/u/alexbg89)\
**Post date:** [December 10, 2019, 4:39pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/3 "2019-12-10T16:39:27Z")

</div>

Thanks for your answer @utaylor Is there any table that are recommended to be use in such case ? (API key, Global Variable ect ect)

I’m under the impression that if I create a UDField in a table, all rows are going to get that new column added.

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [December 10, 2019, 4:42pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/4 "2019-12-10T16:42:37Z")

</div>

Yeah that is right it is going to add the column to the table and then each row has a value for that column.

If your field is company specific and applies to all parts I suppose you could create a UD field on the Company table. I think it is up to you at this point.

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [December 10, 2019, 6:18pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/5 "2019-12-10T18:18:32Z")

</div>

The User Codes would work perfect.

First define a Code Type (think of this as a table name). Then add the code and it’s value (description). You can’t change the Code after it is created. But you could change the value.

And no need to Regen the data model

---

<div class="post-metadata">

**Author:** ![utaylor](https://www.epiusers.help/user_avatar/www.epiusers.help/utaylor/32/64664_2.png) [@utaylor](https://www.epiusers.help/u/utaylor)\
**Post date:** [December 10, 2019, 6:20pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/6 "2019-12-10T18:20:49Z")

</div>

That is another place to do it! I forgot about those!

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [December 10, 2019, 6:32pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/7 "2019-12-10T18:32:06Z")

</div>

Some caveats on using User Codes…

1. You’d be storing your “value” in the description field, which is of type string. So nothing to validate the value against a certain data type
2. I’m not sure how easily it is to update the “value”

Here’s some I made for a Code Type “GLOBAL\_VAR”

 ![image](https://epiusers.help/uploads/default/original/3X/8/8/88d2f7ea69585be5cda8fcd9738b46770a73dfa9.png)

---

<div class="post-metadata">

**Author:** ![alexbg89](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/8dc957/32.png) [@alexbg89](https://www.epiusers.help/u/alexbg89)\
**Post date:** [December 10, 2019, 6:59pm UTC](https://www.epiusers.help/t/best-place-to-put-global-variable-udfield/62601/8 "2019-12-10T18:59:53Z")

</div>

That’s exactly what I needed. This make sense ! Thanks for your answer.
