Can I Reuse an Existing HR Condition with "Is Not" Operator?

N_Snow
Tera Expert

Hello Community!

 

I have a requirement where I need to select multiple job numbers in an HR condition using the "is not" operator. Since the "is not one of" operator is not available, I need to create multiple conditions using "is not".

 

There is an existing HR condition that contains all job numbers with the "is one of" operator. I would like to know if I can reuse this HR condition with the "is not" operator in my new HR criteria. That would really save a lot of time.

 

I would appreciate any help on this.

 

Thanks in advance!

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@N_Snow 

not possible.

you will have to use IS NOT multiple times there

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Kohei Tominaga1
Tera Guru

Hi, @N_Snow 
Operators you can use depends on the type of the field you want to query.

Please check docs here!

 

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

prajaktajga
Mega Guru

Hello @N_Snow ,

 

No, you cannot directly reuse an existing HR Condition and invert it (use “is NOT” against another condition).
HR Conditions in ServiceNow do not support condition nesting, referencing, of another condition.

Wessel van Enk
Tera Guru

Hi @N_Snow,

Did you consider to use a Scripted HR Condition? 
This way you can get all the ''is not'' numbers from your HR condition and filter on it. 

Example:


(function() {
// Get users matching the existing HR Condition
var included = new sn_hr_core.HRCondition().getUsers('existing_condition_sys_id');

// If the current user is NOT in that list, return true
return !included.contains(current.user);
})();