# new form field

**URL:** <https://www.dynamicsuser.net/t/new-form-field/23835>\
**Category:** Developers Forum\
**Created:** [December 15, 2009, 2:45pm UTC](https://www.dynamicsuser.net/t/new-form-field/23835 "2009-12-15T14:45:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![illo29081970](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@illo29081970](https://www.dynamicsuser.net/u/illo29081970)\
**Post date:** [December 15, 2009, 2:45pm UTC](https://www.dynamicsuser.net/t/new-form-field/23835/1 "2009-12-15T14:45:45Z")

</div>

I created a new field in table 207 (No. (service order field from table 5900)).

Add this new field to the form 207. On Validate Trigger added this lines code

No. - OnValidate()

RecServiceHeader.GET(“No.”);

RecServiceHeader.“No.”:= “No.”

In the form 207, when I create a new line, in zoom on this new field i got this error message in attach.

" The expression code cannot be type/converted to a option value "

---

<div class="post-metadata">

**Author:** ![David\_Cox](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@David\_Cox](https://www.dynamicsuser.net/u/David_Cox)\
**Post date:** [December 15, 2009, 3:11pm UTC](https://www.dynamicsuser.net/t/new-form-field/23835/2 "2009-12-15T15:11:00Z")

</div>

Look at the Primary key for the Service Header, you will find it requires two values, first an option, second the code.

Like a Sales Order, SalesHeader.GET(“Document type”::Order, “No.”);

David

---

<div class="post-metadata">

**Author:** ![DRB](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@DRB](https://www.dynamicsuser.net/u/DRB)\
**Post date:** [December 15, 2009, 3:24pm UTC](https://www.dynamicsuser.net/t/new-form-field/23835/3 "2009-12-15T15:24:55Z")

</div>

> [@](#):
>
> RecServiceHeader.GET(“No.”);
> 
> RecServiceHeader.“No.”:= “No.”

In the above GET is not properly used. The Primary Key of Service Header Table( I assume RecServiceHeader is “Service Header”) is Document Type,No., so GET should have two values as parameter.

By the way, what are you trying to achieve?

Edit: David Cox posted while I was writing, I noticed his reply after posting.

---

<div class="post-metadata">

**Author:** ![illo29081970](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@illo29081970](https://www.dynamicsuser.net/u/illo29081970)\
**Post date:** [December 16, 2009, 10:00am UTC](https://www.dynamicsuser.net/t/new-form-field/23835/4 "2009-12-16T10:00:42Z")

</div>

Thanks David

But even if I use the Service header first key

RecServiceHeader.GET(“Document type”::Order, “No.”);

RecServiceHeader.“No.”:= “No.”;

VALIDATE(“No.”);

I get one error that Document type is an unknown variable.

If I want to use the service order field in form 207, how can I do it?

---

<div class="post-metadata">

**Author:** ![DRB](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@DRB](https://www.dynamicsuser.net/u/DRB)\
**Post date:** [December 16, 2009, 10:07am UTC](https://www.dynamicsuser.net/t/new-form-field/23835/5 "2009-12-16T10:07:26Z")

</div>

Luana,

If you will find a record by RecServiceHeader.GET(“Document type”::Order, “No.”), then its RecServiceHeader.“No.”: field is already equal to “No.”.

What is the use/ need of following assignment statement:

RecServiceHeader.“No.”:= “No.”;

---

<div class="post-metadata">

**Author:** ![DaveT](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DaveT](https://www.dynamicsuser.net/u/DaveT)\
**Post date:** [December 16, 2009, 10:07am UTC](https://www.dynamicsuser.net/t/new-form-field/23835/6 "2009-12-16T10:07:44Z")

</div>

Hi,

Add in the variable name e.g.

RecServiceHeader.GET(RecServiceHeader.“Document type”::Order, “No.”);

---

<div class="post-metadata">

**Author:** ![David\_Cox](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@David\_Cox](https://www.dynamicsuser.net/u/David_Cox)\
**Post date:** [December 16, 2009, 10:52am UTC](https://www.dynamicsuser.net/t/new-form-field/23835/7 "2009-12-16T10:52:16Z")

</div>

Ok Lets look at this again, with no code required.

Your table 207 = Res. Journal Line, and you have a field added called “No.” Code 20

You want this to be populated with a Service Header “No.”, so it is as easy as setting the Table \> Field \> Properties \> TableRelation for your new field, use the assist edit and lookup the table and set the filter to give you:

TableRelation = “Service Header”.No. WHERE (Document Type=CONST(Order))

Add the field to the form so the user can lookup and select the Service Header, it is as simple as that!

David

---

<div class="post-metadata">

**Author:** ![illo29081970](https://avatars.discourse-cdn.com/v4/letter/i/7ea924/32.png) [@illo29081970](https://www.dynamicsuser.net/u/illo29081970)\
**Post date:** [December 16, 2009, 12:31pm UTC](https://www.dynamicsuser.net/t/new-form-field/23835/8 "2009-12-16T12:31:08Z")

</div>

Thanks Dave

Every thing is ok now.

By

---

<div class="post-metadata">

**Author:** ![DaveT](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DaveT](https://www.dynamicsuser.net/u/DaveT)\
**Post date:** [December 16, 2009, 4:23pm UTC](https://www.dynamicsuser.net/t/new-form-field/23835/9 "2009-12-16T16:23:26Z")

</div>

Glad to help [:D]
