Override global before query business Rule on subject_person field

Aidy Burrow
Tera Contributor

There is a global business rule (user query) which filters out inactive users on the sys_user table using current.addActiveQuery(); for non admins.

One of our HR services is to raise a case for leavers (within the past 12 months), however there is no way to populate these users in the subject_person field (which is a reference field to the sys_user table) within a HR case as any reference qualifier is always suffixed with active=true, filtering out the users needed for selection. 

This also is an issue with passing the user from a record producer variable - the inserted record's subject_person is empty.

We want to avoid touching the global BR as we only want it to be skipped/bypassed for one particular HR service.

Does anyone else have HR services covering inactive users and is there a way around this?

1 ACCEPTED SOLUTION

Hi,

Best of luck, haha!

If my reply ends up guiding you Correctly, please also mark it as Correct.

Take care! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

8 REPLIES 8

Hi Aidy,

I created new custom field -"Nonactive Subject Person", which only display "Nonactive User" like Aqib Mushtag.  But you need to configure Dictionary of this field like Screenshot 2.   This works for me 

find_real_file.png

Configure Dictionary 

find_real_file.png

Allen Andreas
Administrator
Administrator

Hello,

Since you had called out you didn't want to adjust the global "user query" business rule, I had refrained from responding and was waiting to see what others would come up with.

Unfortunately, since the query BR will intercept and apply the added query, there really isn't a way to get around this without editing it.

You also wouldn't need extensive code to be added to it if you were wanting this to scale (for the platform)

With that said, the common solution I've proposed is to include this small if statement to the current out of box user query business rule script:

var query = current.getEncodedQuery();
if (gs.getSession().isInteractive() && !query.includes('activeANYTHING')) {
//do x (aka your out of box code)
}

So this would allow for any reference qualifier for the sys_user table to simply included, somewhere, "activeANYTHING" and if that is listed, then the user query script, where it appends the active=true, wouldn't apply.

This is useful across the platform .

So while it does have some red tape to go through in your case, you're proposing a scalable solution that others can use, if needed, and shouldn't lead to technical debt.

I would also advise that this change be made on the out of box user query business rule. This allows for it to be reviewed during upgrade and can be assessed if it's still needed, etc.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I'm going to go and do some 'fiddling' with this idea - I see a wealth of possibilities with this approach.

As you mention, it's useful across the platform and our ITSM team would prefer not to have to login with their admin accounts, just to see inactive users.

Cheers

Hi,

Best of luck, haha!

If my reply ends up guiding you Correctly, please also mark it as Correct.

Take care! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!