Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Access to inactive contacts in cases

lamarchel
Giga Expert

Hi!

I'm trying to make inactive contacts appear in the refered list in cases for users with a specific role ("Accès aux inactifs").

I work on a copy of CSmanagementUtils where I made all "addActiveQuery" conditional like this :

 

        if (!gs.hasRole("Accès aux inactifs")) {
            contactGr.addActiveQuery();
        }
 
But it works only with admin role. User with the "Accès aux inactifs" role still can't see inactive contacts.
What am I doing wrong?
 
Thanks!

 

4 REPLIES 4

tiagomacul
Giga Sage

did you try?

tiagomacul_0-1764182027693.png

 



https://<instance>.service-now.com/now/nav/ui/classic/params/target/sn_customerservice_case_list.do%3Fsysparm_query%3Dcontact.active%253Dtrue%255Eactive%253Dtrue%26sysparm_first_row%3D1%26sysparm_view%3Dcase

That's not what I want. I need specific agents to be able to open a case for an inactive contact. 

We are in b2b mode and sometimes some of our clients ask to deactivate some of their users and are a little too enthousiastic about it.

 

When an inactive contact calls the emergency line, we nedd the agent to be able to open a ticket for us to investigate.

 

Sorry if it's not clear, I'm not very fluent in english.

 

Thanks.

🛠Solution : Modification du Qualificatif de Référence (Reference Qualifier)

 

L'approche la plus propre et la plus sûre consiste à modifier le Qualificatif de Référence pour le champ Contact sur le formulaire de Cas. Cela permet de vérifier le rôle de l'utilisateur directement au moment où la liste de contacts est chargée, sans modifier le comportement global des tables de base.

 

1. Identifier le Champ

 

Le champ à modifier est celui qui référence l'enregistrement Contact (probablement le champ contact sur la table sn_customerservice_case).

 

2. Mettre à Jour le Qualificatif de Référence

 

Naviguez dans l'Entrée du Dictionnaire pour ce champ et mettez à jour le Qualificatif de Référence pour qu'il utilise un script Avancé.

Script du Qualificatif de Référence :

JavaScript
 
javascript&colon; new ContactQueryUtils().getContactReferenceQualifier()

----

ENLGISH

Hi! Thanks for clarifying your requirement. Your English is perfectly clear! : )

The problem you described—agents with a specific role needing to open a case for an inactive B2B Contact—is a common scenario in Customer Service Management (CSM).

The previous issue was due to the underlying logic in ServiceNow's Contact reference fields, which usually applies an Active=true filter. Since your agents need to bypass this filter based on a role, the solution is to specifically modify the Reference Qualifier for the Contact field on the Case form.

Here is the step-by-step approach to achieve this:


 

🛠️ Solution: Modifying the Reference Qualifier

 

You need to modify the Dictionary entry for the Contact field on the Case table (likely sn_customerservice_case.contact) to check for the role "Accès aux inactifs" and only apply the active filter if the user does not have the role.

 

1. Identify the Field

 

The field you need to modify is the one that references the Contact record (usually the contact field on the sn_customerservice_case table).

 

2. Update the Reference Qualifier

 

Navigate to the Dictionary Entry for that field and update the Reference Qualifier to use an Advanced script.

Reference Qualifier Script:

The goal is to call a Script Include that returns the appropriate query string.

JavaScript
 
javascript&colon; new ContactQueryUtils().getContactReferenceQualifier()

---

Hi!

I'm not sure but I think that's what I did here is my contact field dictionary:

lamarchel_0-1764246851234.png

GricsCSManagementUtils is my copy of the CSManagementUtils include where I added the condition.