need "else if" condition un business rules

siva14
Tera Contributor

we have created a new property, when the property value matches with assignment group name then in incident form there is choice field, that field sets the value automatically, now we have newly added another group, so we created another property as well.

i want to again match property value with newly created group to set field with different value name called "TSIC", in the same code where to write the ( var, else if) codes.

 

#incident#business rule#else if

 

(function executeRule(current, previous /*null when async*/ ) {
 
    var newValue = current.assignment_group.getDisplayValue();
 
    var telcom = gs.getProperty('test_tsoc_groups');
    
    if (newValue.match(telcom)) {
 
var assGrp = current.assignment_group.name.toString();
var grpSysPrp = gs.getProperty('Test.res.subres.field.open');
if(grpSysPrp.indexOf(assGrp)!=-1) {
 
current.u_inc_type = 'TSOC_NV';
 
} else {
 
        current.u_inc_type = 'TSOC';
 
}
      
    } else {
 
        current.u_inc_type = 'None';
   
    }
 
})(current, previous);
1 ACCEPTED SOLUTION

Sorry, I

  var newValue = current.assignment_group.getDisplayValue();
 
    var telcom = gs.getProperty('test_tsoc_groups');
    var newProperty = gs.getProperty('newProperty');
    
    if (newValue.match(telcom)) {
 
var assGrp = current.assignment_group.name.toString();
var grpSysPrp = gs.getProperty('Test.res.subres.field.open');
if(grpSysPrp.indexOf(assGrp)!=-1) {
 
current.u_inc_type = 'TSOC_NV';
 
} else {
 
        current.u_inc_type = 'TSOC';
 
}
      
    } else if (newValue.match(newProperty)) {
	
	//Do something
	
	} else {
 
        current.u_inc_type = 'None';
   
    }

still don't understand from your description, something like this?

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, unfortunately your post doesn't make your requirement clear. is this what you were looking for?

If not, then perhaps you could update the thread to clarify your question\issue.

if(someCondition) {
//First condition met
 }else if (someOtherCondition) {
//Second condition met
} else {
//No conditions met
}

 

we have created a new property, when the property value matches with assignment group name then in incident form there is choice field, that field sets the value automatically, now we have newly added another group, so we created another property as well.

i want to again match property value with newly created group to set field with different value name called "TSIC", in the same code where to write the ( var, else if) codes.

Sorry, I

  var newValue = current.assignment_group.getDisplayValue();
 
    var telcom = gs.getProperty('test_tsoc_groups');
    var newProperty = gs.getProperty('newProperty');
    
    if (newValue.match(telcom)) {
 
var assGrp = current.assignment_group.name.toString();
var grpSysPrp = gs.getProperty('Test.res.subres.field.open');
if(grpSysPrp.indexOf(assGrp)!=-1) {
 
current.u_inc_type = 'TSOC_NV';
 
} else {
 
        current.u_inc_type = 'TSOC';
 
}
      
    } else if (newValue.match(newProperty)) {
	
	//Do something
	
	} else {
 
        current.u_inc_type = 'None';
   
    }

still don't understand from your description, something like this?