new form field

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 "

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

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.

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?

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.”;

Hi,

Add in the variable name e.g.

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

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

Thanks Dave

Every thing is ok now.

By

Glad to help [:D]