Automatically add filter to reference variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 07:01 AM
When I create a catalog variable that references the user table, I always want to have certain filters in place, such as "Active is true" and "User ID is not empty". I also have a particular variable attribute that should always be added.
Can this be done automatically? In other words, can you create a script to add all the filters and variable attribute as soon as you select the User table as your reference table?
Best regards,
Kim

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 01:36 PM
Sure! Client scripts and UI policies would be how to do that on client. When Reference is set, if value is `sys_user` then g_form.setValue('field','your filter or attributes');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 08:34 AM
I know how to use client scripts and UI policies on a catalog variable. But how to use them on a form? Where would the client script live and how would it know to target that "Reference" field in a variable of type Reference, and how would it create the filters who aren't there to begin with?
Perhaps a simple example would do. I'm very familiar with client scripts and UI policies in a catalog item, but not outside of it.
Thanks.