Quintiq file version 2.0
#parent: ListScenario
Response OnClick (
  structured[Scenario] selection
) id:Response_ListScenario_MenuScenarioNewMacroPlan_OnClick
{
  #keys: '[11766.1.296334891]'
  Body:
  [*
    // To be derived - ScenarioMP
    // Create a new Scenario
    dlg := construct( ScenarioManager_DialogCreateEditMPScenario );
    parent := selection.Element( 0 ).Parent();
    scenario := dlg.NewScenario( this, ScenarioManager, parent, false );
    
    if( not isnull( scenario ) )
    {
      ApplicationLibMacroPlanner.AutoExpandSelection( this, scenario );
      // To make sure the active scenario on the supply chain overview panel is updated
      ApplicationLibMacroPlanner.SelectScenario( scenario, Form );
      
      // Launch supply chain wizard upon scenario creation
      if( ScenarioManager.LaunchInitializationWizardAtScenarioCreation() )
      {
        ApplicationLibMacroPlanner.LaunchInitializationWizard( MacroPlan );
      }
    }
  *]
  CanBindMultiple: false
  DefinitionID => /ListScenario/Responsedef_ListScenario_Menu_OnClick
  Initiator: 'MenuScenarioNewMacroPlan'
  Precondition:
  [*
    return not isnull( ScenarioManager ) and selection.Element( 0 ).CanCreate( feedback, true );
  *]
  UserRequiresReadWrite: true
}
