Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Help Scout 24815
- // process list field 9 (only) into a CSV string to pass to Sugar CRM
- // initialize an empty string to hold field 9 array items
- $field_9_as_csv = '';
- // you have to use a Gravity Forms hook which passes in the $entry to use this code
- foreach ($entry as $key => $value) {
- // the $entry array key begins with a 9, our list field
- if (substr($key, 0, 1) == '9') {
- // if there is a $value for this array key, i.e. not empty
- if (strlen($value) > 0) {
- $field_9_as_csv = $field_9_as_csv . $value . ', ';
- }
- }
- }
- // strip final trailing comma and one space (two characters)
- $field_9_as_csv = substr($field_9_as_csv, 0, -2);
- // send $field_9_as_csv to Sugar CRM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement