# Setting default field values

**URL:** <https://www.epiusers.help/t/setting-default-field-values/61151>\
**Category:** Epicor ERP 10\
**Tags:** customization\
**Created:** [October 24, 2019, 7:24pm UTC](https://www.epiusers.help/t/setting-default-field-values/61151 "2019-10-24T19:24:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulosborne](https://www.epiusers.help/letter_avatar_proxy/v4/letter/p/b5ac83/32.png) [@paulosborne](https://www.epiusers.help/u/paulosborne)\
**Post date:** [October 24, 2019, 7:24pm UTC](https://www.epiusers.help/t/setting-default-field-values/61151/1 "2019-10-24T19:24:04Z")

</div>

This feels like it should be easier to me. I’m trying to set the default qty to 1. I’ve tried changing the value but it doesn’t stay. Have also set the value when the form loads but that doesn’t work either.  
What’s the right way to do this?

 ![image](https://epiusers.help/uploads/default/original/3X/b/0/b057625807459a6a56e9af0a3259e5319ed2f92c.png)

---

<div class="post-metadata">

**Author:** ![Asz0ka](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Asz0ka](https://www.epiusers.help/u/Asz0ka)\
**Post date:** [October 24, 2019, 7:49pm UTC](https://www.epiusers.help/t/setting-default-field-values/61151/2 "2019-10-24T19:49:07Z")

</div>

I’ve banged my head against this before, here’s some code I found to get it to stick (this is on the Corrective Action Entry module) I used the form event wizard to get the EpiViewNotifcation event code, then added the if statement and view.dataView.edit parts:

```
private void edvDMRCorAct_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	// **Argument Properties and Uses**
	// view.dataView[args.Row]["FieldName"]
	// args.Row, args.Column, args.Sender, args.NotifyType
	// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
	if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
	{
		if ((args.Row > -1))
		{
			if (Convert.ToInt32(nonconfTextBox.Value) == 0)
			{
				view.dataView[view.Row].BeginEdit();
				view.dataView[view.Row]["NonConfNum"]=1;
				view.dataView[view.Row].EndEdit();
			}
		}
	}
}

```

![image](https://epiusers.help/uploads/default/original/3X/4/6/46fffe3f3ad17c33e82109060030e2c1e1492724.png)

After clicking new:

![image](https://epiusers.help/uploads/default/original/3X/5/8/58509750dae9778352294e6eb0ab21dcacf532bd.png)

You should be able to do something similar and just change the “NonConfNum” part to the desired epibinding.

---

<div class="post-metadata">

**Author:** ![paulosborne](https://www.epiusers.help/letter_avatar_proxy/v4/letter/p/b5ac83/32.png) [@paulosborne](https://www.epiusers.help/u/paulosborne)\
**Post date:** [October 24, 2019, 9:02pm UTC](https://www.epiusers.help/t/setting-default-field-values/61151/3 "2019-10-24T21:02:00Z")

</div>

Thank you @Asz0ka that did the trick. Feel like it should be easier but that isn’t too bad.
