Created
October 10, 2014 19:00
-
-
Save blainelang/51792e3fdfd4bfea8112 to your computer and use it in GitHub Desktop.
Code snippet to launch a maestro workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Code to launch a maestro workflow. | |
* Pass in the template ID and security token | |
* Once the workflow instance is launched, it | |
* returns the new process id | |
*/ | |
$template = 1; // Set to the maestro template you want to launch | |
$sec_token = drupal_get_token('maestro_user'); | |
$new_process_id = maestro_launch_workflow($template, $sec_token); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tracking_id = db_select('maestro_process') | |
->fields('maestro_process', array('tracking_id')) | |
->condition('id', $newprocess, '=') | |
->execute()->fetchField(); | |
$template_data_id = db_select('maestro_template_data') | |
->fields('maestro_template_data', array('id')) | |
->condition('task_class_name', 'MaestroTaskTypeContentType', '=') | |
->execute()->fetchField(); | |
db_insert('maestro_project_content') | |
->fields(array( | |
'nid' => $node_wrapper->nid->value(), | |
'tracking_id' => $tracking_id, | |
'task_id' => 0, | |
'content_type' => $node_wrapper->type->value(), | |
'status' => $status | |
)) | |
->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment