Skip to content

Instantly share code, notes, and snippets.

@tylerdigital
Last active August 12, 2018 13:24
Show Gist options
  • Save tylerdigital/717d432cf71bd87f7bd4 to your computer and use it in GitHub Desktop.
Save tylerdigital/717d432cf71bd87f7bd4 to your computer and use it in GitHub Desktop.
Advanced Custom Logic workflow with Gravity Forms to Asana
<?php
add_filter( 'gfasana_task_details', 'my_custom_asana_logic', 10, 5 );
function my_custom_asana_logic( $asana_task, $user_index, $project_index, $entry, $form ) {
/* $asana_task array format: */
/*
Array
(
[workspace] => 1234567890123 // don't change this almost ever
[name] => New Task - overridden // string of text for task name
[notes] => long description here // string of texgt
[assignee] => 12345810427453 // Assigned User ID (ID in Asana) – use $user_index to conveniently reference users by name
[projects] => Array // Array of Project IDs (IDs in Asana ) – use $project_index to conveniently reference projects by name (dangerous if the project name changes in the future)
(
[0] => 12346299730116
)
[followers] => Array // Array of Followers by Asana User ID – use $user_index to conveniently reference users by name
(
)
[due_on] => tomorrow // can use relative dates (ie. "tomorrow", "Monday", "+3 weeks") or a specific date "12/1"
)
*/
/* Enter custom logic */
if ( $entry['2'] == 'ASAP' ) {
/* If our priority dropdown menu (Gravity Form ID 2) is ASAP then customize workflow */
$asana_task['projects'] = array( $project_index['Priority'], $project_index['Bugs'] );
$asana_task['assignee'] = $user_index['Nathan'];
$asana_task['due_on'] = 'today';
$asana_task['followers'] = array( $user_index['Nathan'], $user_index['Sean'] );
}
return $asana_task;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment