Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditAccountStructure_OnOK
{
  #keys: '[139394.0.458421571]'
  Body:
  [*
    // On ok
    //DropDownListParentAccount is bind to decractive relation, so set parentname before commit
    DataHolderDialogData.Data().ParentName( guard( DropDownListParentAccount.Data().Name(), "" ) );
    
    //DropDownListAccountType  is bind to declaractive relation, so before commit set the user account type name to the attribute
    DataHolderDialogData.Data().UserAccountTypeName( guard( DropDownListAccountType.Data().Name(),"" ) );
    this.ApplyChanges();
    
    DataHolderDialogData.Data().Commit();
    
    if( not isnull( DataHolderForm.Data() ) )
    {
      // Access the form, select the new account and focus to the list
      DataHolderForm.Data().ListAccountStructure().SelectByKey( DataHolderDialogData.Data().WrappedInstance().Key());
    }
    
    this.Close();
  *]
}
