Muhammad Khan
Mega Sage
Mega Sage

Let's say we are stuck in a situation where we have lots of catalog items in which we have a reference variable which is referring User [sys_user] table, and it is the beauty of our implementation that we did not use the variable set in this case. 

Upon that we are presented with a business requirement to display multiple column values in those reference variables in the service portal for each and every catalog item. Nailed it!

It seems that we are done because we are left with a hectic process of adding variable attribute in each and every catalog item to display multiple column values.

But there is one approach which can save you from this hectic work, and that is to add variable attribute at the table level in the dictionary record of type collection. By the way, email column values along with the name values are already available by default in the service portal because of the attribute ref_ac_columns=email which is already available in that record.

ref_ac_columns=email,ref_ac_columns_search=true,ref_ac_order_by=name,ref_auto_completer=AJAXTableCompleter
Note: This is going to be a global change, means it will impact all the places where User [sys_user] table has been referred.
Good Thing: The good thing about it is that you can override it on places where User [sys_user] table has been referred, by specifying the attribute again as per your requirement. So, technically you can tackle the global change as well.

Let's see how we can achieve that.

Use Case:
I have a reference variable referring User [sys_user] table in two different catalog items. I need to display company and department along with the name and email.

First Catalog Item

As you can see in the below image that there is no variable attribute.

find_real_file.png

Second Catalog Item

There is also no variable attribute in this item as well.

find_real_file.png

Service Portal results before implementation

First Catalog Item

find_real_file.png

Second Catalog Item

find_real_file.png

As you can see in the above before implementation images that email column values along with the name values are already available by default because of the attribute which we have seen earlier in this article.

Let's find that dictionary level table record and modify that attribute to add required columns.

1-) Open any user record and navigate to dictionary via Configure > Dictionary

find_real_file.png

2-) Search for collection type record by applying filter and open that record.

find_real_file.png

3-) Click on the Advanced view related link.

find_real_file.png

4-) Added backend names of company and department columns/fields.

find_real_file.png

 

That's pretty much it. Let's observe the results.

Output / Results:

First Catalog Item

find_real_file.png

Second Catalog Item

find_real_file.png

 

 

Let's validate the point/note Good Thing to tackle Global Change

Added a variable attribute in Second Catalog Item to show the manager column values along with the name values.

find_real_file.png

Output / Result

find_real_file.png

 

 

Interested in reading my other articles, go through the below link.

Useful Implementation for Service Portal and Native UI

 

 

Always open to learn new things.

Happy Learning

Comments
Priyanka1997
Tera Contributor

Hi @Muhammad Khan ,

 

I have same requirement But it is not working for me.

I want to create records in target table ( cmdb_rel_ci) based on Model ID instead of Name of CI.

Is It Possible??

 

Kindly assist me.

ntera4sho1
Tera Contributor

Hi,

 

Quick question, is it possible to do the same on a SearchList input type on Agent Mobile App?

 

Regards,

N

Jacques Clement
Kilo Sage
Kilo Sage

Hi @Muhammad Khan - thanks for sharing. Do you know if there's a way to also display the column label on top of the list? I think I saw it on one of the instances I worked on, but can't remember how it was done. Maybe an undocumented attribute?

Version history
Last update:
‎09-13-2022 01:15 AM
Updated by: