Using Gravity Forms ‘gform_capsulecrm_case’ PHP filter

The gform_capsulecrm_case Gravity Forms PHP filter allows you to modify the Capsule CRM Case object before it is created.

Usage

A generic example of how to use the filter:

add_filter('gform_capsulecrm_case', 'your_function_name', 10, 4);

To target a specific form, append the form id to the hook name:

add_filter('gform_capsulecrm_case_1', 'your_function_name', 10, 4);

To target a specific feed for a form, append the form id and feed id to the hook name:

add_filter('gform_capsulecrm_case_1_7', 'your_function_name', 10, 4);

Parameters

  • $case (array): Capsule CRM case.
  • $form (Form Object): The current form.
  • $entry (Entry Object): The current entry.
  • $feed (Feed Object): The current feed.

More information

See Gravity Forms Docs: gform_capsulecrm_case

Examples

Change the description of the case

add_filter('gform_capsulecrm_case', 'change_case_object', 10, 4);
function change_case_object($case, $form, $entry, $feed) {
    $case['description'] = 'Created by API';
    return $case;
}

Change the status of the case

add_filter('gform_capsulecrm_case', 'change_case_status', 10, 4);
function change_case_status($case, $form, $entry, $feed) {
    $case['status'] = 'CLOSED';
    return $case;
}

Update the party id

add_filter('gform_capsulecrm_case', 'update_party_id', 10, 4);
function update_party_id($case, $form, $entry, $feed) {
    $case['party']['id'] = 123456789;
    return $case;
}

Update the party owner username

add_filter('gform_capsulecrm_case', 'update_party_owner_username', 10, 4);
function update_party_owner_username($case, $form, $entry, $feed) {
    $case['party']['owner']['username'] = 'newuser';
    return $case;
}

Add a custom field to the case

add_filter('gform_capsulecrm_case', 'add_custom_field', 10, 4);
function add_custom_field($case, $form, $entry, $feed) {
    $case['custom_fields'] = array(
        'field_name' => 'field_value'
    );
    return $case;
}