Please note that there are no IDs for fields. You need to first throw the records IDs into one array, and then get the values of their fields in another array.
Let's look at a simple example. We have one Account, which has several Opportunities. Each Opportunity has a field called Multi-Enum.
To collect and combine all the values of the Multi-Enum fields of the related Opportunities in the formula script for the Account, you need to do the following:
Code:
$oppIds = record\findRelatedMany('Account', id, 'opportunities', 10000);
$i = 0;
$multiEnums = list();
$values = list();
while ($i < array\length($oppIds)) {
$multiEnum = record\attribute('Opportunity', array\at($oppIds, $i), 'multiEnum');
$multiEnums = array\push($multiEnums, $multiEnum);
$y = 0;
while ($y < array\length($multiEnum)) {
$value = array\at($multiEnum, $y);
$values = array\push($values, $value);
$y = $y + 1;
}
$i = $i + 1;
}


Leave a comment: