How to display group name instead of sys_id

Brandon R1
Tera Contributor

I'm using a Lookup Select Box variable for a 2nd approval in my catalog item. This variable is referencing the sys_user_group table and I have a reference qualifier specifying the 3 groups to be referenced for the drop-down selection in the variable on the form.

find_real_file.png

In order for the workflow to stop (instead of automatically skip) at this "Approval - Group" activity, the lookup value field for the variable has to be the Sys_ID instead of Name. For the Lookup Select Box field on the form, I need it to display the group names NOT the Sys_IDs.

find_real_file.png

I think the best way to achieve this is to use a Catalog Client Script but I'm unsure of how it should be written. Can someone help me with this??

Thanks,
Brandon

 

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Instead of using Lookup Select Box, how about using Reference type? Reference type will enable to  display Name field and still use sys_id.

View solution in original post

11 REPLIES 11

Changing it from Lookup Select Box to Reference did the trick. I thought I had tried Reference but maybe not. I think there was a specific reason why I didn't try this but I'm glad I reached out for another set of "eyes" on this. Thanks!

 

Gaurav Shirsat
Mega Sage

Hi Brandon

You have to use the perform this using the reference field.Your Reference Field always points to Another Table.

Ex.Caller field in Incident form always fetching data from sys_user Table.

Here you have to Glide the Table and then you can make use of the get method.

 

Example
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',gs.getUserID());
gr.query();
while(gr.next()){
gs.print(gr.group.name);
}

Please Mark Correct and Helpful

Thanks and Regards

Gaurav Shirsat

sriram35
Kilo Guru

Hi Brandon,

 

In Lookup Value Field Directly select value as Name Instead of sys_id. Then you will get the group names.

 

find_real_file.png

 

find_real_file.png

 

Hope this helps!

If you have any more questions, please let me know.

If I have answered your question, please mark my response as correct and/or helpful.

Thanks,

Sriram

Brandon R1
Tera Contributor

Using "Name" in the Lookup Value Field or Lookup Label Field breaks my workflow, which is why I have to use Sys_ID. 

My workflow has two approvals, and this one is the 2nd approval. Using "Name" causes this 2nd approval to get skipped every time. Using Sys_ID keeps it from being skipped.

I need a client script that will display the group's name on the Lookup Select Box on the catalog item form view. Currently, it only shows the Sys_ID which is not acceptable for the end-user.

 

Add name to label field

find_real_file.png

To get name in approval activity you can do current.variables.XXXX.getDisplayValue();

To get value in approval activity you can do current.variables.XXXX.getValue();