I was able to implement my own custom action that does this specifically for the sub-assigned field. The UI only allows the selection of a single field to perform an action on, so I used that as the source of where I want to copy a value from. This action will always copy it to the subassigned field but could be modified to alter other fields:
add_filter( 'dt_workflows_custom_actions', function ( $actions ) {
$actions[] = (object) [
'id' => 'mtm_copy_to_subassigned',
'name' => 'Copy Relation Field to Sub-assigned',
'displayed' => true // Within admin workflow builder view?
];
return $actions;
}, 10, 1 );
add_action( 'mtm_copy_to_subassigned', function ( $post, $field, $value ) {
if ( !empty( $post ) && $post['post_type'] === 'contacts' ) {
$updated_post = [];
$updated_post['subassigned']['values'] = [];
if ( !empty( $post[$field] ) ) {
foreach ( $post[$field] as $connection ) {
$updated_post['subassigned']['values'][] = [
'value' => $connection['ID'],
];
}
}
// Assuming we have updated fields, proceed with post update!
if ( !empty( $updated_post['subassigned']['values'] ) ) {
$updated_post['subassigned']['force_values'] = true;
DT_Posts::update_post($post['post_type'], $post['ID'], $updated_post, false, false);
}
}
}, 10, 3 );