Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Autopopulate Service Offering based on selection of Business Application

Abhishek8
Tera Contributor

I have 2 reference variables as described below on a catalog Item:

business_application reference to cmdb_ci_business_app

service_offering references to service_offering

 

Requirement is if  User selects "LES/MES - Mexico" in business_application then on service_offering it should get autopopulated as "LES/MES Application "

 

Similarly we have population of service_offering  based on business_application as below :

LES/MES - SenegalLES/MES Application for PMMSN
LES/MES - MexicoLES/MES Application for Mexico
LES/MES - BrazilLES/MES Application for Brazil
  
  
  
  

 

How can we achieve this in a a catalog item

1 ACCEPTED SOLUTION

ayushraj7012933
Kilo Guru

 

Hi @,

You can achieve this requirement using an onChange Catalog Client Script on the business_application variable.

Whenever the user selects a Business Application, you can set the corresponding Service Offering using 

g_form.setValue()

.

Example:

 

 
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}

var mapping = {
'SYS_ID_MEXICO': 'SYS_ID_SO_MEXICO',
'SYS_ID_SENEGAL': 'SYS_ID_SO_SENEGAL',
'SYS_ID_BRAZIL': 'SYS_ID_SO_BRAZIL'
};

if (mapping[newValue]) {
g_form.setValue('service_offering', mapping[newValue]);
} else {
g_form.clearValue('service_offering');
}
}
 

Make sure to use sys_ids instead of display values for accurate mapping.

View solution in original post

1 REPLY 1

ayushraj7012933
Kilo Guru

 

Hi @,

You can achieve this requirement using an onChange Catalog Client Script on the business_application variable.

Whenever the user selects a Business Application, you can set the corresponding Service Offering using 

g_form.setValue()

.

Example:

 

 
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}

var mapping = {
'SYS_ID_MEXICO': 'SYS_ID_SO_MEXICO',
'SYS_ID_SENEGAL': 'SYS_ID_SO_SENEGAL',
'SYS_ID_BRAZIL': 'SYS_ID_SO_BRAZIL'
};

if (mapping[newValue]) {
g_form.setValue('service_offering', mapping[newValue]);
} else {
g_form.clearValue('service_offering');
}
}
 

Make sure to use sys_ids instead of display values for accurate mapping.