Home Forums Front-end Issues Using Gravity Forms to add Relationship Field


Using Gravity Forms to add Relationship Field

  • Is it possible to have a form populate a relationship field? I have a form that is passing on an ID that needs to get saved in a relationship field… This is using a GF hidden field. It appears that the relationship meta value is being populated with a straight-up value, but of course relationship fields need to be serialized. What are the other values in the serialized value for? Could I just find a way to add the other details on to my ID?

  • I was able to figure it out thanks to this:

    One thing I ran into is that if I needed the serialized value for a field, the “get_post_custom_values” function worked. Otherwise, the ACF “get_field” function was what I needed for other types of fields.

    add_action("gform_after_submission_2", "acf_post_submission", 10, 2);
    function acf_post_submission ($entry, $form)
    	$post_id = $entry["post_id"];
    	// funding status
    	$values = get_field("reviewer_funding_status", $post_id); 
    	echo "<br />reviewer_funding_status: " . $values;
    	update_field("field_519f97aab12f7", $values, $post_id);
    	// rating - overall
    	$values = get_field("rating_overall", $post_id); 
    	echo "<br />rating_overall: " . $values;
    	update_field("field_519f989ab12f8", $values, $post_id);
    	// rating - clarity of mission
    	$values = get_field("rating_clarity_of_mission", $post_id); 
    	echo "<br />rating_clarity_of_mission: " . $values;
    	update_field("field_520be9eac3f72", $values, $post_id);
    	// rating - communications
    	$values = get_field("rating_communications", $post_id); 	
    	echo "<br />rating_communications: " . $values;
    	update_field("field_519f98d4b12f9", $values, $post_id);
    	// rating - evaluation
    	$values = get_field("rating_evaluation", $post_id); 
    	echo "<br />rating_evaluation: " . $values;
    	update_field("field_520be9fdc3f73", $values, $post_id);					
            // funder ID
    	$values = get_post_custom_values("funder_id", $post_id);
    	echo "<br />funder_id - serialized: " . $values;	
    	update_field("field_519f996ce16ca", $values, $post_id);
  • Hi @relish27

    Glad you found a solution, and thanks for posting the code.

    Great work

  • holy crap this is super helpful!

  • I totally forgot about this… may have to reference it myself sometime, ha!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Using Gravity Forms to add Relationship Field’ is closed to new replies.