Hello,
I'm trying to 'play' with the lookup field type and its 'fetch mode' in Deluge. So, I have a lookup field, 'user', in a form. When I use it in a Deluge script within a Workflow, I can access all properties of my 'referenced' field. For example, if 'user' contains 'Name', 'Surname', and 'Email', I can access all of these properties through my lookup field:
userName = input.lookupUser.Name;
userSurname = input.lookupUser.Surname;
userEmail = input.lookupUser.Email;
All of the above statements work properly, although the return type of input.lookupUser is a BIGINT (which seems correct because a lookup field tracks the ID of the referenced form). So, why can I access all of the record properties without an explicit fetch such as:
user = Users[ID == input.lookupUser];
But okay, I'm in with this feature. This behavior, however, is strange because if I have a function in my app that accepts a 'User' and pass it my lookup reference, my function isn't able to access all the properties; they are all null. This becomes even stranger when I try to figure out the types of my variables. For example, I have a function, void testFunction(User user). If I pass input.lookupUser, I receive a type mismatch error (BIGINT != User). However, if I store my input into a variable, I can pass the same value to the function, and it recognizes my input as a 'User' instead of a BIGINT.
Can you help me understand the fetch behavior behind a lookup field?