challenges with IndexOf function

sainath3
Mega Guru

Hi Team,

 

Am facing challenges with the IndexOf function.

 

below is the requirement: 

 

Based on the Short description Assignment group should be updated.

below are the keyword and assignment groups.

If the short description contains any below keywords respective assignment group should populate in the assignment group field.

KeywordAssignment group
Late chargesAccount department
Smart chargesSNTP department
Site Visit chargesSNTP department
Other chargesAccount department

I have Created two different system properties for Above Assignment groups.

Properties are: 

Account Department: Late charges, Ot.her Charges

SNTP Department: Smart charges, Site Visit charges.

 

My code:

Var circuitReference="Issues are related to Late charges"

Var exclude_identifier = gs.getProperty("Account department").toLowerCase().split(",");
circuitReference = circuitReference.toLowerCase();
for (var key in exclude_identifier) {
if (circuitReference.indexOf(exclude_identifier[key]) != -1) {
current.u_assignment_group = 'Account department';
}
}

var exclude_identifier1 = gs.getProperty("SNTP Department").toLowerCase().split(",");
for (var key in exclude_identifier1) {
                    if (circuitReference.indexOf(exclude_identifier1[key]) != -1) {                                      
current.u_assignment_group = 'SNTP department';                          
                      }
                    }
                }
 
Output is:  SNTP department.
Expected output is: Account department.
RCA: Charges keyword is available in both the groups.
 
Please help me here .....

 

10 REPLIES 10

Shamma Negi
Kilo Sage
Kilo Sage

try removing this line as it is converting it to small case:

 

Var circuitReference="Issues are related to Late charges"

Var exclude_identifier = gs.getProperty("Account department").toLowerCase().split(",");
circuitReference = circuitReference.toLowerCase();
for (var key in exclude_identifier) {
if (circuitReference.indexOf(exclude_identifier[key]) != -1) {
current.u_assignment_group = 'Account department';
}
}

var exclude_identifier1 = gs.getProperty("SNTP Department").toLowerCase().split(",");
for (var key in exclude_identifier1) {
                    if (circuitReference.indexOf(exclude_identifier1[key]) != -1) {                                      
current.u_assignment_group = 'SNTP department';                          
                      }
                    }
                }
Regards,Shamma Negi