Patch to fix TAGs with Gravity ZOHO add-on!

Thanks to Google Gemini, it works!:

add to functions.php this:

add_filter( ‘gform_zohocrm_record’, ‘fix_zoho_tags_format’, 10, 5 );
function fix_zoho_tags_format( $record, $module, $feed, $entry, $form ) {

// Controlliamo che stiamo inviando ai Lead (o Contacts) e che esista il campo Tag
if ( $module === 'Leads' && isset( $record['data'][0]['Tag'] ) ) {
    
    $tag_value = $record['data'][0]['Tag'];
    
    // Se il tag non è vuoto, lo trasformiamo nell'array richiesto dalle API v2/v3 di Zoho
    if ( ! empty( $tag_value ) ) {
        $record['data'][0]['Tag'] = array(
            array( 'name' => $tag_value )
        );
    }
}

return $record;

}

TAGs now perfectly works.

If you want to credit me: elan42.com
bye

1 Like

I am not sure, but as a developer it will surely fail if there are multiple tags. Possible a better option as below

add_filter( ‘gform_zohocrm_record’, ‘fix_zoho_tags_format’, 10, 5 );

function fix_zoho_tags_format( $record, $module, $feed, $entry, $form ) {

  // Controlliamo che stiamo inviando ai Lead (o Contacts) e che esista il campo Tag

  if ( $module === 'Leads' &&  !empty($record['data'])) {

    // Se il tag non è vuoto, lo trasformiamo nell'array richiesto dalle API v2/v3 di Zoho

    foreach($record['data'] as $tagIndex => $tagData) {

      $record['data'][$tagIndex]['Tag'] = array(

        array( 'name' => $tagData['Tag'])

      );

    }

  }

  return $record;

}

good!
give it a fix on the next versions :wink:

I had to functions.php-ize this
but I would like the plugin to works with TAGs natively