Skip to content

Instantly share code, notes, and snippets.

@jodzeee
Created March 7, 2025 20:22
Show Gist options
  • Save jodzeee/624d7641156d1a332b1296e020c9cd10 to your computer and use it in GitHub Desktop.
Save jodzeee/624d7641156d1a332b1296e020c9cd10 to your computer and use it in GitHub Desktop.
Send child entries to Salesforce
<?php
// Change 36 to your parent form ID
add_action( 'gform_after_submission_36', function( $entry, $form ){
global $vxg_salesforce;
$parent_entry = new GPNF_Entry( $entry );
$child_entries = $parent_entry->get_child_entries( 25 ); // Change 25 to the Nested Form field ID in the parent (FIELD ID, NOT FORM ID)
foreach ( $child_entries as $child_entry ){
$child_form = GFAPI::get_form( rgar( $child_entry, 'form_id' ) );
$vxg_salesforce->push( $child_entry, $child_form );
}
}, 10, 2 );
// Change 31 to your parent form ID
add_action( 'gform_after_submission_31', function( $entry, $form ){
global $vxg_salesforce;
$parent_entry = new GPNF_Entry( $entry );
$child_entries = $parent_entry->get_child_entries( 31 ); // Change 31 to the Nested Form field ID in the parent (FIELD ID, NOT FORM ID)
foreach ( $child_entries as $child_entry ){
$child_form = GFAPI::get_form( rgar( $child_entry, 'form_id' ) );
$vxg_salesforce->push( $child_entry, $child_form );
}
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment