Excluding retired classes in ci on incident form

Harithapola
Tera Contributor

we implemented principal class   class need to displayed on ci field on incident table. but principal class shows even retried class . so how to restrict retried class while using principal class as reference qualifier on CI field on incident 

On incident form, ci field lookup filtering condition needs to be updated (excluding retired ci's)

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Harithapola 

 

https://www.servicenow.com/community/developer-forum/prinicipal-class-need-to-displayed-on-ci-on-inc...

 

To restrict the retired class while using the principal class as a reference qualifier on the CI field on the incident table, you can follow these steps:

1. Navigate to the incident table by typing 'incident.list' in the left navigation filter.
2. Open any incident record.
3. Right-click on the 'Configuration Item' field label and select 'Configure Dictionary'.
4. In the 'Dictionary Entry' form, scroll down to the 'Attributes' related list.
5. Add a new attribute with the name 'ref_qual_elements' and the value 'u_principal_class,u_retired_class'.
6. In the 'Value' field, enter a JavaScript condition that checks if the principal class is not retired. For example, "javascript: 'u_principal_class=true^u_retired_class!=true'".
7. Click 'Update' to save the changes.

This will ensure that only non-retired principal classes are displayed in the CI field on the incident table.

Please note that 'u_principal_class' and 'u_retired_class' should be replaced with the actual field names in your instance. Also, the condition in the JavaScript code should be adjusted according to your requirements.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Mark Manders
Mega Patron

Can you share your current reference qualifier?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

sys_class_nameINjavascript:new BHRPrincipalClass().getPrincipalClasses()

You will need to change the script include that gets the principal classes. I am a bit confused, though: are you really using retired classes, or are you seeing retired CI's from the principal classes? 

Something like this may help:

 

getPrincipalClassesWithActiveStatus: function() {
    var principalClasses = this.getPrincipalClasses(); // Original method to get principal classes
    var activeCondition = "state!=retired"; // Assuming 'state' field holds the retirement status, and 'retired' is the value for retired CIs
    return principalClasses + "^" + activeCondition; // Combining the conditions
}

 


your ref.qualifier could look like this: sys_class_nameINjavascript:new BHRPrincipalClass().getPrincipalClassesWithActiveStatus() (or make it a dictionary override).


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark