Not available for not working as expected

ShAn21
Tera Guru

Hi Team,

Do we have any known issues with using 'Available for ' and 'Not Available for' in a catalog item together. I have built a very simple condition to 'Not Available For' but see it is not working as expected. Ideally not availble for must override available for.

Available for = Role itil

Not Available for = User type external

 

But i see even for external users the item is visible.

 

Thanks

14 REPLIES 14

Tejas Adhalrao
Tera Guru

Hi @ShAn21  ,

This is expected behavior,

If you need a single place to control visibility for 100+ items, the supported approach is:

          -   Use User Criteria with both include and exclude logic

          -  Apply that User Criteria in Available For

              -  Avoid mixing Available For and Not Available For together

If the user satisfies any allow condition (for example, having the itil role), the item can still be shown even if they also match Not Available For

 

Hi @Tejas Adhalrao 

Any specific reason it does not work?

The funny part is even a simple log in script section of 'Not Available for' is not working. Same user criteria when added to 'Available for' does show logs. Additionally if we use fields instead of script in 'Not Available for' user criteria it works. Only script does not run.

 

Thanks

Hi @ShAn21  ,

this behavior is actually by design, not a defect.

When ServiceNow evaluates visibility for a catalog item, it first checks the “Available For” criteria to determine who can see the item.If the user matches at least one Available For condition, the item is shown.

 

The “Not Available For” logic only runs after that, but only for field-based user criteria.
For script-based criteria inside “Not Available For,” the platform intentionally does not execute the script, because the visibility check for excluded users is optimized and does not evaluate scripted logic for performance and security reasons.

 

Apply that User Criteria only in the “Available For” field of the Catalog Item.

 

 

 

If you found my solution helpful, please mark it as Helpful or Accepted Solution...!

thanks,

tejas

Email: adhalraotejas1018@gmail.com

LinkedIn: https://www.linkedin.com/in/tejas1018

sangrulkaradvai
Kilo Guru

Keep only available for,sers who don’t meet the Available For criteria won’t see the item. If you remove Not Available For and only set Available For, the item should be hidden from everyone who doesn’t meet that criteria.

Hi @sangrulkaradvai 

Any specific reason it does not work?

The funny part is even a simple log in script section of 'Not Available for' is not working. Same user criteria when added to 'Available for' does show logs. Additionally if we use fields instead of script in 'Not Available for' user criteria it works. Only script does not run.

 

Thanks