How to access catalog item attributes from user criteria script

acirovic1
Giga Expert

Within entitlement scripts it was possible to access the catalog item using current object and calling current.getID() to retrieve the catalog item sys_id.

With user criteria script, this is no longer possible as there is no access to the current object. Does somebody know how to access the catalog item attributes from within a user criteria script.

Regards,

Alex

11 REPLIES 11

I've tried, and I've not seen that it's possible thus far. I imagine that you could insert in some jelly code to the various catalog pages that would execute the entitlement scripts for each item as it attempts to show it in a category or display the form, but from my experience of modifying those catalog pages, it would be quite a bit of work.



What I've decided to do is to write a script that will create the proper User Criteria and attach it automatically to the proper catalog items.



I'm not sure what your level of comfort with programming is, but you might consider this as an option.



Example:


Say you have a boolean field on the Catalog Item table that says "Restricted Access". Write a business rule that whenever that field becomes true, it adds some particular user criteria onto the item, and removes all other user criteria present. And then write a business rule that whenever that field becomes false, it removes that particular user criteria from the item, and adds some other criteria on.



This is essentially what I'm doing, but a bit more complex. My customer had a bunch of custom tables that essentially replicated user criteria, and they're not ready to let those tables go quite yet. As a result, I'm creating a Script Include that will perform the conversion for them, and keep the criteria up to date at all times.



Not a solution to your issue, but perhaps food for thought of another approach to take.


I was thinking along those lines already. Still pity you can't reference the current object and accept performance penalty, or at least be able to have both evaluated, first the user criteria and then entitlement script.



Thanks for sharing your ideas.



Bye,


Alex