<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: gform_after_submission in backend and entry modification</title>
		<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification</link>
		<description>Gravity Support Forums Topic: gform_after_submission in backend and entry modification</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 18:39:01 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/gform_after_submission-in-backend-and-entry-modification" rel="self" type="application/rss+xml" />

		<item>
			<title>David Peralty on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-94836</link>
			<pubDate>Fri, 23 Nov 2012 13:27:19 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">94836@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Glad to hear it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-94704</link>
			<pubDate>Fri, 23 Nov 2012 07:08:28 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">94704@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you friendo!&#60;br /&#62;
Works like a charm.&#60;/p&#62;
&#60;p&#62;Here's my code if anyone need it:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_after_update_entry&#38;quot;, &#38;quot;update_entry&#38;quot;, 10, 2);
function update_entry($form, $entry_id){
	$lead = RGFormsModel::get_lead($entry_id);

	$company_field = RGFormsModel::get_field($form, [your company field ID]);
	$company = RGFormsModel::get_lead_field_value($lead, $company_field);

	$status_field = RGFormsModel::get_field($form, [your status field ID]);
	$status = RGFormsModel::get_lead_field_value($lead, $status_field);

	$contact_email_field = RGFormsModel::get_field($form, [your contact email field ID]);
	$contact_email = RGFormsModel::get_lead_field_value($lead, $contact_email_field);

	$send_email_field = RGFormsModel::get_field($form, [your send email field ID]);
	$send_email = RGFormsModel::get_lead_field_value($lead, $send_email_field);

	// Send a notification email to the admin
	$to = blog_info( &#38;quot;admin_email&#38;quot; );

	$headers = &#38;#39;From: [Your Company Name] &#38;lt;&#38;#39;.$to.&#38;#39;&#38;gt;&#38;#39; . &#38;quot;\r\n&#38;quot;;

	$subject = &#38;quot;The status of entry &#38;quot;.$company.&#38;quot; has changed.&#38;quot;;

	$message = &#38;quot;The status of brand &#38;quot;.$company.&#38;quot; has changed to &#38;quot;.$status.&#38;quot;\n\n&#38;quot;;

	if ( $send_email == &#38;quot;Yes&#38;quot; )
		$message .= &#38;quot;An email was sent.&#38;quot;;
	else
		$message .= &#38;quot;No email was sent.&#38;quot;;

	wp_mail($to, $subject, $message, $headers);
	// End of amdin notification email

	// Send an email to the client that filled the form
	$headers = &#38;#39;From: [Your Company Name] &#38;lt;&#38;#39;.$to.&#38;#39;&#38;gt;&#38;#39; . &#38;quot;\r\n&#38;quot;;

	$today = date(&#38;quot;F j, Y, g:i a&#38;quot;);
	$last_sent_text = &#38;#39;&#38;#39;;

	// Check if the admin wants to send an email and send the corresponding email
	if ( $send_email == &#38;quot;Yes&#38;quot; &#38;amp;&#38;amp; $status == [the status] ) {
		$subject = [Email subject];

		$message = [Email content];

		wp_mail($contact_email, $subject, $message, $headers);

		$last_sent_text = $status.&#38;quot; the &#38;quot;.$today;
	}
	else if ( $send_email == &#38;quot;Yes&#38;quot; &#38;amp;&#38;amp; $status == [other status] ) {
		[other email]
		...
	}

	// If an email was sent, update the Last Sent Email and Send Email values
	if ( $send_email == &#38;quot;Yes&#38;quot; )
	{
		global $wpdb;

		// Update Last Sent Mail field
		if ( !$wpdb-&#38;gt;update(
				$wpdb-&#38;gt;prefix.&#38;quot;rg_lead_detail&#38;quot;,
				array(&#38;#39;value&#38;#39; =&#38;gt; $last_sent_text),
				array(&#38;#39;field_number&#38;#39; =&#38;gt; [your last sent email field ID],
					&#38;#39;lead_id&#38;#39; =&#38;gt; $entry_id,
					&#38;#39;form_id&#38;#39; =&#38;gt; $form[&#38;#39;id&#38;#39;]
				)
				)
			)
		{
			// If update returns false, create the field
			$wpdb-&#38;gt;insert(
				$wpdb-&#38;gt;prefix.&#38;quot;rg_lead_detail&#38;quot;,
				array(&#38;#39;value&#38;#39; =&#38;gt; $last_sent_text,
					&#38;#39;field_number&#38;#39; =&#38;gt; [your lest sent email field ID],
					&#38;#39;lead_id&#38;#39; =&#38;gt; $entry_id,
					&#38;#39;form_id&#38;#39; =&#38;gt; $form[&#38;#39;id&#38;#39;]
				)
			);
		}

		// Update Send Email field to &#38;quot;No&#38;quot; (to make sure that emails are not sent by mistake)
		$wpdb-&#38;gt;update(
			$wpdb-&#38;gt;prefix.&#38;quot;rg_lead_detail&#38;quot;,
			array(&#38;#39;value&#38;#39; =&#38;gt; &#38;quot;No&#38;quot;),
			array(&#38;#39;field_number&#38;#39; =&#38;gt; [your send email field ID],
				&#38;#39;lead_id&#38;#39; =&#38;gt; $entry_id,
				&#38;#39;form_id&#38;#39; =&#38;gt; $form[&#38;#39;id&#38;#39;]
			)
		);
	}
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-94572</link>
			<pubDate>Thu, 22 Nov 2012 22:45:02 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">94572@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You are going to have to resort to some &#34;direct to database&#34; calls I think.  I've used this before:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
$wpdb-&#38;gt;update(&#38;quot;{$wpdb-&#38;gt;prefix}rg_lead_detail&#38;quot;, array(
	&#38;#39;value&#38;#39; =&#38;gt; $your_value,
	&#38;#39;field_number&#38;#39; =&#38;gt; $field_number,
	&#38;#39;lead_id&#38;#39; =&#38;gt; $entry[&#38;#39;id&#38;#39;],
	&#38;#39;form_id&#38;#39; =&#38;gt; $entry[&#38;#39;form_id&#38;#39;]
));&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-94391</link>
			<pubDate>Thu, 22 Nov 2012 10:14:19 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">94391@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;FINALLY FOUND A PARTIAL SOLUTION!!!&#60;/p&#62;
&#60;p&#62;To get the field value:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_after_update_entry&#38;quot;, &#38;quot;update_entry&#38;quot;, 10, 2);
function update_entry($form, $entry_id){

	$lead = RGFormsModel::get_lead($entry_id);
$field = RGFormsModel::get_field($form, [the field ID]);
$brand = RGFormsModel::get_lead_field_value($lead, $field);

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Now, looking for the next step: updating a field value!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-94326</link>
			<pubDate>Thu, 22 Nov 2012 05:43:26 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">94326@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Dear team,&#60;/p&#62;
&#60;p&#62;I still did not get any answer...&#60;br /&#62;
I really need this support.&#60;br /&#62;
I am trying to find a way but I am still stuck...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-93893</link>
			<pubDate>Wed, 21 Nov 2012 05:05:31 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">93893@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Woops:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_after_update_entry&#38;quot;, &#38;quot;update_entry&#38;quot;, 10, 2);
function update_entry($form, $entry_id){

	$lead = RGFormsModel::get_lead($entry_id);
	$value = RGFormsModel::get_field_value_long($lead, 1, $form, false);

}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-93890</link>
			<pubDate>Wed, 21 Nov 2012 05:02:22 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">93890@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I tried this but no luck...&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pastie.org/5410767&#34; rel=&#34;nofollow&#34;&#62;http://pastie.org/5410767&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Should it work? Would it work with radio fields?&#60;br /&#62;
Is there a set_field_value method?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-93378</link>
			<pubDate>Tue, 20 Nov 2012 04:39:44 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">93378@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Email sent!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-93006</link>
			<pubDate>Mon, 19 Nov 2012 11:17:49 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">93006@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Charles, please send me an email at &#60;a href=&#34;mailto:chris@rocketgenius.com&#34;&#62;chris@rocketgenius.com&#60;/a&#62; and include a link to this topic.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Arye on "gform_after_submission in backend and entry modification"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/gform_after_submission-in-backend-and-entry-modification#post-92919</link>
			<pubDate>Mon, 19 Nov 2012 07:49:27 +0000</pubDate>
			<dc:creator>Arye</dc:creator>
			<guid isPermaLink="false">92919@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Chris,&#60;/p&#62;
&#60;p&#62;Really need support on this one....
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
