Filter table based in array from system property

Nisha30
Kilo Sage

Hi ,

we have set many system properties which contains table names comma separated.

 

Example: hard.ci.pop 

Nisha30_0-1751290238016.png

1)need to call this property from Script Include

2) the result of this should be : 'Configuration Item' field should display records only from these tables.

 

How do I achieve this

 

Thanks

 

1 ACCEPTED SOLUTION

Hi @Nisha30 ,

 

 

in the question you have share the property screenshot value contains ";" at the end

remove the ";" at the end of the property value in the system property

 

update the ref qual as below

 

javascript: "sys_class_nameIN" + new global.getincTables().getTableNames(current.getValue('category'));

 

 

 

update/keep the script include method as below

 

getTableNames: function(chkcategory) {
    chkcategory = chkcategory.toLowerCase();
    if (chkcategory == 'hardware')
        return gs.getProperty('inc.filter.hardware');
    else if (chkcategory == 'software')
        return gs.getProperty('inc.filter.software')
    else if (chkcategory == 'exchange')
        return gs.getProperty('inc.filter.exchange')
    else
        return ''
}

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

 

 

View solution in original post

23 REPLIES 23

hi @Ankur Bawiskar 

yes i can see in logs for below you suggested and all logs .

gs.info(chkcategory); 

 

@Nisha30 

so category is getting printed fine?

did you check the dictionary override point which I mentioned?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

hI @Ankur Bawiskar 

 

the CATEGORY is giving logs yes.

Nisha30_1-1751369973352.png

 

1. when i open the CI field from incident, it opens the task dictionary and thats where i have put reference qualifier now.

 

2. Dictionary override in task table for me as below , i dont have for incident, is that something to be created ? and update with Reference qualifier there? and should the task ref qualifier be removed then?

Nisha30_0-1751369802364.png

 

Thanks

 

@Nisha30 

yes you should create a dictionary override for incident since that field is at task level

If you add it directly in dictionary then it will impact all the tables which use this field.

do what I shared above in screenshots and create new dictionary override record

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

You are pushing 'sys_id' into the array in each case. Don't you want the value of the property instead?

If I read your post correctly, and you want the property value, then you need a comma-delimited string to use in the reference qualifier. To get that, join that array before returning it, or join it in the calling code.

 

getTableNames: function(chkcategory){
  var arr = [];
  ...
  return arr.join(',');
}