$subParams = array_merge($genericParams, $entityparams);
_civicrm_api_replace_variables($subAPI[1], $subaction, $subParams, $result['values'][$idIndex], $separator);
$result['values'][$result['id']][$field][] = civicrm_api($subEntity, $subaction, $subParams);
$subParams = array_merge($genericParams, $entityparams);
_civicrm_api_replace_variables($subAPI[1], $subaction, $subParams, $result['values'][$idIndex], $separator);
$result['values'][$result['id']][$field][] = civicrm_api($subEntity, $subaction, $subParams);