If you want to set the default AX model for all of your active user accounts on a certain layer, you may run the following job to do so.
Whenever a new developer joins in, you may include running this job in your account creation process to make sure they do not try to check in code to the wrong place, but only to your correct default AX model.
Do not forget to change the layer and the name of the model.
static void WIK_UpdateDefaultModel(Args _args)
{
UserInfo userInfo;
UserInfoStartupModel userInfoStartupModel;
UserInfoStartupModel userInfoStartupModelDB;
UtilEntryLevel layer = UtilEntryLevel::cus;
ModelId modelId = any2int((select firstOnly Model from SysModelManifest where SysModelManifest.Name == 'MyModel').Model);
ttsBegin;
while select userInfo
where userInfo.accountType == UserAccountType::ADUser
notexists join userInfoStartupModel
where userInfoStartupModel.UserId == userInfo.id
&& userInfoStartupModel.Layer == layer
&& userInfoStartupModel.ModelId == modelId
{
userInfoStartupModelDB.clear();
userInfoStartupModelDB.initValue();
userInfoStartupModelDB.Layer = layer;
userInfoStartupModelDB.UserId = userInfo.id;
userInfoStartupModelDB.ModelId = modelId;
try
{
if (userInfoStartupModelDB.validateWrite())
{
userInfoStartupModelDB.insert();
}
else
{
throw error('We have a problem');
}
}
catch
{
exceptionTextFallThrough();
}
}
update_recordset userInfoStartupModel
setting ModelId = modelId
where userInfoStartupModel.Layer == layer;
ttsCommit;
}
MSDN link for UserInfoStartupModel: https://msdn.microsoft.com/en-us/library/userinfostartupmodel.aspx