5

I have installed and configure the "Maestro" Module in Drupal Commons.

In Maestro Module every time we should Load the Workflow and it will go through step by step:

  1. Admin: Publishing Workflow Load
  2. User1: Assigend to add new Content
  3. User2: Review Content
  4. User3: Publish Content

How can I remove first step? When user creates new content, it should automatically go for review.

My Workflow Block diagram of workflow

Using the rules module Can I define any rule when New Content is created means click on "Add Content" Workflow automatic Load....

  • I have a similar issue except that I want a webform submission for a particular form to always initiate a workflow. Any thoughts on how I might achieve this? – Kasapo Apr 1 '14 at 16:52
3

A solution we have used where we needed to have a menu item launch a workflow for expense approval using an entityform. The menu URL just needed to pass in the maestro workflow template_id

The callback function for the menu hook launches the workflow and then executes past the START task in the maestro template, to the first interactive task for the user (fill out form). It redirects the user to the task console and automatically opens the expense form to be filled in. The following code can be added to a custom module and re-purposed for your use.

/**
 * Implements hook_menu()
 */
function MODULE_NAME_menu() {
  $items = array();

  $items['pi_workflow/launch_eform'] = array(
    'title' => 'Launch Entityform Workflow',
    'page callback' => 'nextide_launch_eform_workflow',
    'page arguments' => array(2) ,      // Passing in wildcard which should be the maestro workflow template_id
    'type' => MENU_CALLBACK,
    'access arguments' => array('maestro taskconsole')
  );


  return $items;
}


/* Launch an entityform workflow where the first task
 * after the start task is the entityform task.
 * User will be redirected to the taskconsole and launch the first task (open form for editing)
 */
function nextide_launch_eform_workflow($template) {
  if (intval($template) > 0) {
    $sec_token = drupal_get_token('maestro_user');
    $new_process_id = maestro_launch_workflow($template, $sec_token);

    // Run the orchestrator to execute the first task after the start task which is the interactive entityform task
    maestro_orchestrator();
    $maestro = Maestro::createMaestroObject(1);
    $process_data = $maestro->engine()->getQueueHistory($new_process_id);

    $task = MaestroTask::createTaskObject($process_data[1]->id);
    $data = $task->prepareTask();
    $task_data = unserialize($data['serialized_data']);

    // Default will be to redirect user to the task console unless overlay module is available
    $link = 'maestro/taskconsole';
    $options = array();
    // Test that we have valid process data and then test for the task we are looking for to get the task id
    if (is_array($process_data) AND isset($process_data[1])) {
      // If overlay module is enabled and user has overlay permission, open entityform up in overlay
      if (module_exists('overlay') && overlay_get_mode() ) {
        $options = array('fragment' => "overlay=eform/submit/{$task_data['entityform_id']}/maestro/" . $process_data[1]->id);
      }
    }
    drupal_goto($link, $options);
  } else {
    drupal_set_message(t("New Process Code FAIL! - No Template ID Given"));
  }

}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.