Creating a Secondary entity in a custom Component

Hi,

as I am not able to track entity creation in a custom component (probably because Entity Wizard scripting is not able to be tracked in the current active component), I'm trying to create my entity by adding manual scripting in my Component ".ec file".

Here is what I did :

/*

Chargement de la librairie MC_common_es

*/

function LoadCommon() {
MC_fso = new ActiveXObject("Scripting.FileSystemObject");
MC_installpath = GetInstallDir();
var file = MC_fso.OpenTextFile(MC_installpath + '\\INF\\COMMON\\MC_common_es.js');
var content = file.ReadAll();
file.Close();
return content;
}
eval(decodeURIComponent(escape(LoadCommon())));


/*

Création de l'entité MyCustomSecondaryEntity

*/

var UTF = new RegExp("\xEF\xBB\xBF");
strErrEnd = String(MC_inittrans("ERREND", "Erreur d'installation du composant 'COMPNAME'!! ", "Error installing 'COMPNAME'!!")).replace(/COMPNAME/g, Param('CompName'));

sValid = true;
var ErrorStr = '';

var EntName = 'MyCustomSecondaryEntity'; // Entity_Name
var EntCaption = 'MyCustomEntity'; // Entity_Caption
var EntPrefix = 'inte'; // Entity_Prefix
var CompName = 'MyCustomSecondaryEntity'; // RecordAsComponent

var ToDo = false; // has_ToDo
var Chanel = false; // has_Chanel
var Add_to_find = false; // has_Add_To_find
var Add_to_new = false; // has_Add_To_new

var HasComm = false; // has_HasComm
var HasCases = false; // has_HasCases
var HasOppo = false; // has_HasOppo
var HasLib = false; // has_HasLib

var HasEscalation = true; // has_escalation
var HasTalendKey = true; // has_talendkey

var isDependof = true;
var EntDependOf = 'COMPANY'; // Depend_de

/*Here Is probably what I am missing because my entity is creating as a Primary entity. What is the parameter to create it as a secondary entity ?
// IS_PRIMARY

var HasWorkflow = false; // WorkflowManagement
var HasWorkflowProgress = false; // WorkflowManagement

var RunOnMobileDevice = false;

if (sValid) {
MC_inittrans('EntName' + EntName, EntCaption, EntCaption);
booAddToList = true;
AddToAdvFind = true;

// Création entité et interface
MC_createentity();

// Mise en invisible de l'entrée ajoutée dans Component
filter = "SELECT * FROM Components where cmp_name ='" + CompName + "'";
sComp = eWare.CreateQueryObj(filter);
sComp.SelectSql();
if (!sComp.eof) {
sComp.cmp_description=null;
sComp.SaveChanges();
}
}
else {
MC_install(lib = strErrEnd, "ERREND");
valid = false;
ErrorStr = MC_tabinstall;
}

MC_install("End");

--------------------------------

Thanks for your help !!

Proconsult