Cant fetch record from lookup field

Cant fetch record from lookup field

Hi,

Followed the tutorial for fetching a record.

https://www.zoho.com/creator/help/script/fetch-records.html

Went with option 3 as this is exactly what I am trying to do.

I have 2 forms



Form 1 is called "Anst_llda"

Form 2 is called "Uppdrag"

I have a lookup at Form 2 pointing to Form 1. This lookup is called "Anst_lld"

I want the Email field from Form 1 to be copied to a field in Form 2 called "UserID"



Here is the code that I added on the lookup field. Even tried adding it to "On Edit" and "On Success" as well.
It accepts the code, but does not copy the data....



if (Anst_llda[ID == input.Anst_lld].count()  >  0)
{
    x  =  Anst_llda  [ID == input.Anst_lld];
    //input. refers to fields in current form
    input.UserID = x.Email;
}


Help would be appreciated...