Domain separation issue

Ketan Pandey
Tera Expert

while doing domain separation assignment,

I am getting the error while renaming the company name from MSP to 'Cloud Dimension' ,i am getting the below error 'invalid update' while doing the further investigation i found that the following business rule is throwing the error ;validate_only_one_primary;

 

code 

var test = new GlideRecord('core_company');
test.addQuery('primary', 'true');
test.addQuery('sys_id', '!=', current.sys_id);
test.query();
if (test.next()) {
   current.setAbortAction(true);
   var error = gs.getMessage('Only one company record may be defined as primary') +
      '. "' + test.name + '" ' +
      gs.getMessage('is currently the primary company.');
   current.primary.setError(error);
}
 
As per the code ,only one company can be primary .I just want to understand what is the mean of primary and use of it
3 REPLIES 3

Ketan Pandey
Tera Expert

what i understand from the code is that ,there can be only one primary company ,want to understand what is the logic behind this.

Nishant8
Giga Sage

Hello @Ketan Pandey , Ideally, there should be only one primary company configured in the system. As far as usage of Primary company is concerned, primary company is associated with default values such as banner image and banner text of the instance. If you go and modify the settings under System properties->my company and refresh the browser, you can see changed values reflected.

Regarding the error message, you instance seems to have more than one primary companies configured that is strange from the very first look. However, if this is your test instance, you can run background script (you can use

setWorkflow(false)) and keep only one company as primary that will allow the modification.
 
Regards,
Nishant

 

Regards,

Nishant

Doing the course now and there is indeed a second company in the lab instance also marked Primary called "Your name here". Deleting that solved the problem of renaming MSP to Cloud Dimensions.