- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
The reference variable is for the User(sys_user) table. When you select a user, email and department from sys_user are copied to email and department variables. This could be a very common use case for all catalog admins. But what if I tell you that you can achieve the entire flow without writing a single line of code?
Let's see how we can use the power of Service Catalog and achieve this without writing a single line of code. The short answer to the magic is Catalog Data Lookup. Catalog Data Lookup lets you define a custom lookup table (extending dl_matcher). Then you can have the matcher define which can set the variable with values defined in the setter, when a valid match is found. But in the example we are using, the sys_user table that does not extend dl_matcher. So ho did the Data Lookup work?
How to configure Data Lookup
1. Go to System Definition > Tables > Data Lookup Definitions(dl_definition).
2. Under the Columns tab, select Matcher Table.
3. Under the Dictionary Overrides tab, click New. From Table drop-down list, select Catalog Data Lookup Definitions. Select the Override Attributes checkbox and then enter base_table=
4. Create a Catalog Item; for example, create a Test Item (Testing Lookup) with the following variables:
a) Type: Reference
Name: requested_for
Question: Requested For
Reference: sys_user
b) Type: Lookup Select Box
Name: dept
Question: Department
Lookup from table: cmn_department
Lookup value field: sys_id
Lookup label field(s): name
Include None: Checked
c) Type: Single Line Text
Name: email
Question: Email
5. Create a Catalog UI Policy
Name: Make Readonly
Policy Action: Make Department and Email readonly
6. Navigate to System Policy > Rules > Data Lookup Definitions. Click New and select Catalog Data Lookup Rule.
7. Create a Catalog Lookup Definition.
8. Create a Catalog Matcher Variable Definition.
9. Create Catalog Setter Variable Definitions.
That is all! The catalog item is ready for the magic shown.
Plugin required: Data Lookup and Record Matching Support for Service Catalog (com.glide.data_lookup.catalog).
This works on any field type, but the only limitation is that, Catalog Data Lookup works only on field change. So update your workflow to work with the field change. From Jakarta, the same setup works for Service Portal as well.
- 4,392 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.