I am experiencing an odd bug while attempting to access contents stored in a name field. I will explain how to replicate:
Say we have three forms: Form_A, Form_B, and Form_C.
Form_A fields:
Lookup Field A --> Form_B
Form_B fields:
Name Field name
Single Line sl_1
...
Single Line sl_N
Form_C fields:
Look Up Field C --> Form_A
Form_C Deluge: On User Input of Lookup Field C
- for each form_a_record in Form_A [ ID == C.ID]
- alert (form_a_record.A.name) // ERROR
- alert (form_a_record.A.name.first_name) // Returns null for all records
- alert (form_a_record.A.sl_1) Works as expected
- form_c_record = Form_C [ ID == form_a_record.A ]
- alert (form_c_record.name) // ERROR
- alert (form_c_record.name.first_name) // Returns null for the first record, works for others?
- alert (form_c_record.sl_1) // Works as expected
From my testing I can access the field values of Form_C directly using the dot notation so long as the field type is not of a name field type. You can see this in lines 2 - 4 in the above code.
Attempting to access a name field value from Form_C using the dot notation returns an error stating:
"UnPredictable exception".
Attempting to access a name field from Form_C using dot notation and specifying .first_name or .last_name always returns null.
Attempting to access any field other than a name field in Form_C using dot notation works perfectly fine.
In
the past Zoho Customer Service has instructed me to limit how deeply I
traverse related records. Suggesting that the notation of
From_A.lookup_field_A.related_form_field is not advisable. To address
this I attempt to fetch the records and store it in a separate container
(noted on line 5). The results of this approach are seen in lines 6 -
8.
Line 6 throws the same error as 2
For
line 7 things get a bit strange. If the number of records returned == 1
the return result will be null. If the number of records returned > 1
the first returned result will be null however the remaining return results will work correctly!!! mind boggling.
Line
8 works in the same manner as line 4. This is the case regardless of
whether or not the number of records returned is => 1.
I have tested this extensively and have had issues with the name field returning null in the past.
Just
to really make sure this I'm communicating clearly here is what the
form definitions would look like and what some sample data would be.
Form_A Definition
Field Type
| Field_Name
| Related Form
|
Lookup
| A
| Form_B
|
Form_B Definition
Field Type
| Field_Name
| Related Form
|
name field
| name
| N/A
|
single line
| sl_1
| N/A
|
....
| ....
| ....
|
single line
| sl_N
| N/A
|
Form_C Definition
Field Type
| Field_Name
| Related Form
|
Lookup
| c
| Form A
|
Sample Records Form_B
Record ID
| name
| sl_1
| ....
| sl_N
|
3441121000003400170
| Bruce Banner
| test
| ....
| test
|
3441121000003400171
| Dick Tracey
| test
| ,,,,
| test
|
3441121000003400172
| Bruce Wayne
| test
| ....
| test
|
Sample Records Form_A
Record ID
| A
|
3441121000003400200
| 3441121000003400170
|
| |
| |
Please
let me know what you find. This is a real thorn in my side and has
forced me into some rather unsatisfactory and "hacky" solutions.
Thanks,
Michael