You'd need name of value list,
$name = $record->getField('ValueListName'); //$result may be "found set", not a record. $record = $result->getFirstRecord();
$values = $layout->getValueListTwoFields($name);
That's what I thought, and I tried that exact thing and it always generates an error. I also tried calling the variable as a global variable, but from what I can tell in my research, the variable can't be called inside the function.
If I print_r in your example the value of $name, I get the name of the value list, so I know that it's working, but when I try to insert the variable like you suggested into the function, it doesn't produce a list - it just ends up as a blank value list.
1 of 1 people found this helpful
Is your value list static? Dynamic (conditional, values from related table) value list needs record id as second parameter,
array getValueListTwoFields (string $valueList, [string $recid = null])
Thanks for the input. Everything I read didn't include the recordID requirement in the function. What actually opened my eyes was having you ask the question about related tables with the data - which ended up ultimately being the culprit. I had permissions to view the records in the related table, but field access was set to none, so it wouldn't generate the list. Thanks for all the tips and pointers!