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

I can do it but, the real problem is in both the properties having the keyword is charges. So there is an ambiguity to populate the assignment group 

Can you please share screenshot of your properties configured in instance?

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Anil Lande
Kilo Patron

Hi,

I don't see any issue in your script except for the first two lines variable declaration part.

You are using 'Var' instead of 'var'.

Please update below two lines :

Var circuitReference="Issues are related to Late charges"

Var exclude_identifier = gs.getProperty("Account department").toLowerCase().split(",");

 

Like this:

var circuitReference="Issues are related to Late charges"

var exclude_identifier = gs.getProperty("Account department").toLowerCase().split(",");

 

Also make sure you have correct comma separated value stored in your properties (no extra spaces);

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

I tried but same result. 

the real problem is in both the properties having the keyword is charges. So there is an ambiguity to populate the assignment group 

Shamma Negi
Kilo Sage
Kilo Sage

Create a table with these information with 2 string field:

 

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

 

It will help you to maintain the records as well in future.

 

Regards,Shamma Negi