How to update a different entry after doing calculations

Hello I have successfully extracted data from a form submission, calculated fields and added them back into the entry (i did this because my form was slow and needed to speed up the form). However, can anyone point me in the right direction to send the results to a different entry and not the same entry? Many thanks

Hello. You can use the GFAPI::update_entry function:

$result = GFAPI::update_entry( $entry );

Here is the documentation:

Let us know if you run into any trouble.

Is this something you need to have happen on a regular basis / following each form submission? The Gravity Flow Form Connector has an Update an Entry step type which might be a very good fit if so. Depending on approach, performing the calculation as its’ own custom step would be worth considering too.


Thanks this looks like it will work.

@chrishajer so at the moment, I have something like this, ill water it down.

add_action( ‘gform_pre_submission_51’, ‘input_calculate’ );
function input_calculate( $form ) {
$calcium = rgpost( ‘input_1’);
$calciumprevious = rgpost( ‘input_132’);

$result = $calcium + $calciumprevious;

So If I add at the end
$result = GFAPI::update_entry( $entry );

How can I get the $result to go in entry 5000 field 415 for example?

Currently Im using

$_POST[‘input_415’] = $result;

to add it back into the same entry.

Many thanks for your help

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.