|
2 | 2 | /** |
3 | 3 | * Gravity Connect // Airtable // Create Phone Number Relation |
4 | 4 | * |
| 5 | + * Experimental Snippet 🧪 |
| 6 | + * |
5 | 7 | * This snippet demonstrates how to create a relation between two tables in Airtable |
6 | 8 | * when a GC Airtable feed is being processed. It uses an example assuming the following: |
7 | 9 | * |
8 | | - * 1. There are a "People" table and "Phone Numbers" table in Airtable. |
9 | | - * 2. The "Phone Numbers" table has, at minimum, a phone number field and a link field. |
10 | | - * 3. There is a GCA feed that creates a record in the "People" table. |
11 | | - * 4. The snippet adds a phone number to the "Phone Numbers" table and creates a relation |
| 10 | + * 1. There are a "People" table and "Phone Numbers" table in Airtable. |
| 11 | + * 2. The "Phone Numbers" table has, at minimum, a phone number field and a link field. |
| 12 | + * 3. There is a GCA feed that creates a record in the "People" table. |
| 13 | + * 4. The snippet adds a phone number to the "Phone Numbers" table and creates a relation |
12 | 14 | * between the newly created "People" record and the "Phone Numbers" record. |
13 | 15 | * |
14 | 16 | * Installation: |
15 | 17 | * 1. Install per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/ |
16 | 18 | * |
17 | | - * https://gravitywiz.com/documentation/gravity-connect-airtable |
| 19 | + * References: |
| 20 | + * * https://gravitywiz.com/documentation/gravity-connect-airtable |
| 21 | + * * https://gravitywiz.com/documentation/gca_entry_added_to_airtable/ |
18 | 22 | */ |
19 | 23 |
|
| 24 | +/** |
| 25 | + * You can also apply this to individual forms for feeds for more granular control. For example: |
| 26 | + * |
| 27 | + * add_action( 'gca_entry_added_to_airtable_FORMID', function( $entry, $create_record_resp, $gca_connection_instance ) {} ); |
| 28 | + * add_action( 'gca_entry_added_to_airtable_FORMID_FEEDID', function( $entry, $create_record_resp, $gca_connection_instance ) {} ); |
| 29 | + * |
| 30 | + */ |
20 | 31 | add_action( 'gca_entry_added_to_airtable', function( $entry, $create_record_resp, $gca_connection_instance ) { |
21 | 32 | $gf_phone_number_field_id = '1'; // The ID of the form field which contains the value you want to use to create the relation. |
22 | 33 | $table_id = 'TODO'; // The ID of the Phone number |
|
0 commit comments