# Want to force the initial value of that field

**URL:** <https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414>\
**Category:** Developers Forum\
**Created:** [November 24, 2004, 4:10pm UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414 "2004-11-24T16:10:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LarryRR](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LarryRR](https://www.dynamicsuser.net/u/LarryRR)\
**Post date:** [November 24, 2004, 4:10pm UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414/1 "2004-11-24T16:10:19Z")

</div>

Cash Receipt Journal form (255) allows record entry into Gen. Journal Line table (81). If the user tabs through the Document Type field, it remains blank, which corresponds to value 0 for that field in the table and in the form. The validation specified in the field properties of the form are bypassed when the user presses tab. I want to force the initial value of that field in this form to Payment (value 1), which is the 2nd value of OptionString. How can I have the initial value of that field for a new record only in this form default to the 2nd value of the OptionString (1 aka Payment)? I cannot change the table because it is used in many other places where this change would be unwanted. (Attain 3.60) Thanks!

---

<div class="post-metadata">

**Author:** ![hhelgesen](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/hhelgesen/32/7755_2.png) [@hhelgesen](https://www.dynamicsuser.net/u/hhelgesen)\
**Post date:** [November 24, 2004, 6:12pm UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414/2 "2004-11-24T18:12:29Z")

</div>

On the form, you can take a look at the OnNewRecord function!

---

<div class="post-metadata">

**Author:** ![Nelson](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@Nelson](https://www.dynamicsuser.net/u/Nelson)\
**Post date:** [November 24, 2004, 7:48pm UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414/3 "2004-11-24T19:48:58Z")

</div>

Which in turn is calling the SetUpNewLine Function in the Gen. Journal Line Table. You can either adapt this Function or put your code directly on the Form Trigger.

---

<div class="post-metadata">

**Author:** ![asramaboy](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@asramaboy](https://www.dynamicsuser.net/u/asramaboy)\
**Post date:** [November 25, 2004, 12:34am UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414/4 "2004-11-25T00:34:17Z")

</div>

LarryRR, You can try to change to properties of Form call “SourceTableView” to only allow this form to show “Payment” only. You should change the properties of field “Document Type” call “Editable” to false. If you don’t change this properties then will the line will disappear if user manully change the “Document Type” to other value.

---

<div class="post-metadata">

**Author:** ![asramaboy](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@asramaboy](https://www.dynamicsuser.net/u/asramaboy)\
**Post date:** [November 25, 2004, 12:37am UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414/5 "2004-11-25T00:37:38Z")

</div>

LarryRR, The change will not allow user to change the document type (be careful)

---

<div class="post-metadata">

**Author:** ![LarryRR](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LarryRR](https://www.dynamicsuser.net/u/LarryRR)\
**Post date:** [November 25, 2004, 2:39pm UTC](https://www.dynamicsuser.net/t/want-to-force-the-initial-value-of-that-field/9414/6 "2004-11-25T14:39:32Z")

</div>

What I found out is that I don’t yet have a license to access the C/AL code of a form. Therefore I’m not able to try your suggestions! I will try them once I have the license. Thanks, all.
