Jun 23, 2023 12:32 PM
In my template table I have a lookup field that is formatted as currency. In the child table I have the same field with the same formatting, but I'm getting an "root must be a number" error when I run the script. I'm guessing this needs to be modified in some way because of the lookup field issue, but I'm not sure how:
Solved! Go to Solution.
Jun 23, 2023 03:33 PM - edited Jun 23, 2023 03:36 PM
Lookup field values are returned as arrays.
try
'templateRate': c.getCellValue('Rate')[0],
Fun facts: It can look weird in the console at first because arrays are objects in Javascript which can have extra properties added to them other than the values stored in the array (for example, lookup field arrays have linkedRecordIds and valuesByLinkedRecordId properties added to them). You can see this by running console.log(typeof []) which outputs "object" and console.log(Array.isArray([])) which outputs true.
Jun 23, 2023 02:02 PM - edited Jun 23, 2023 03:27 PM
This may help better explain my question ... This the excerpt from script where the value from the template. The lines in question are in bold. The Rate field in the template is a lookup with the result formatted as currency. The Rate field in the child (target) table is a currency field.
Jun 23, 2023 03:33 PM - edited Jun 23, 2023 03:36 PM
Lookup field values are returned as arrays.
try
'templateRate': c.getCellValue('Rate')[0],
Fun facts: It can look weird in the console at first because arrays are objects in Javascript which can have extra properties added to them other than the values stored in the array (for example, lookup field arrays have linkedRecordIds and valuesByLinkedRecordId properties added to them). You can see this by running console.log(typeof []) which outputs "object" and console.log(Array.isArray([])) which outputs true.
Jun 23, 2023 05:40 PM
That was it. Thank you! I'm not skilled in JS - so I truly appreciate the assistance, and the added "fun facts." I'll also review the link you sent. Learning something new is never a bad thing.