| Quintiq file version 2.0 | 
| #parent: #root | 
| Method New ( | 
|   FormCampaign formCampaign, | 
|   Unit unit, | 
|   CampaignType_MP campaigntype | 
| ) id:Method_DialogCreateEditCampaign_New | 
| { | 
|   #keys: '[134266.1.1951136376]' | 
|   Body: | 
|   [* | 
|     // Create a new campaign | 
|      | 
|     // Select an owner | 
|     if( isnull( unit ) ) | 
|     { | 
|       unit := select( DataHolderUnit.Data(), Elements, u, u.CampaignType_MP( relsize ) > 0  ); | 
|     } | 
|      | 
|     if( isnull( campaigntype ) ) | 
|     { | 
|       campaigntype := select( unit, CampaignType_MP, c, true ); | 
|     } | 
|      | 
|     campaign := unit.Campaign_MP( relshadow, UnitID := unit.ID(),  CampaignID := "" );// Temporary set CampaignID to empty, will be assigned during OnOK | 
|      | 
|     DataHolderForm.Data( formCampaign ); | 
|      | 
|     // Set data to dataholder because Form cannot bind to shadow yet | 
|     DataHolderDialogData.Data( &campaign ); | 
|      | 
|     // Set default values from campaign type | 
|     this.SetDefaultValue( campaigntype ); | 
|     ApplicationMacroPlanner.ShowFormModal( this ); | 
|      | 
|     //Initialize dialog | 
|     Form.InitializeDialog(); | 
|     Form.EnableDisableQuantityEditors(); | 
|   *] | 
| } |