Catalog Item : Change display value for each value of a reference variable

Guillaume D
Tera Contributor

Hello,

I'm currently working on a Catalog Item were I lookup data of the knowledge table.

The first catalog question (Q1) is a reference variable on "kb_knowledge" with a few filter to limit the list.

Following questions are auto-populated based on the article choose in Q1.

 

My issue is that the default display value in Q1 is the "display_number" field,

but I would like the user to be able to search by short_description instead (because it contain an ID from another system and it's the information they will know).

 

My Question : What is the best way to proceed ? Can I keep Q1 as a reference variable but update all the display value ?

 

I tried to use a Lookup Select Box, it do the job for the display value itself, but I can't use the "Auto-populate" based on Q1 value anymore...

I looked into "setValue(String fieldName, String value, String displayValue)" but not sure how to use it for my need or if it would even work.

 

I want to minimize the amount of scripting as much as possible to achieve this. 

Changing the default display field in the table is not an option.


Let me know if you need more details.

Thank you for your help !

EDIT 1 :

I just though of maybe using Lookup Select Box for presenting the choice to the user in Q1, and then use the answer to set an hidden reference variable (Q2) with the same answer, and base all my Auto-populate on Q2 instead.
What do you think ? Would this work ? Is there a better option ?

I just found out that Lookup select box is limited to 10,000 choices and this knowledge base has over 20k articles (even when filtered), so this is no longer an option...

 

EDIT 2 : Precisions

I don't want to change the display value of the selected article, I want to change all the display value in the list before the user get to select one.
Currently, Q1 is configure only trough the variable form, I have no client script to populate it. But I try to change display value with a Client Script
I added screenshot of the Q1 Variable Config, Q1 on the Service Portal and Q2 Variable config.

 

KB_Variable.pngKB_QuestionList.png

KB_Variable_Q2.png

1 ACCEPTED SOLUTION

Yeah...Looks like it works

https://www.servicenow.com/community/itsm-forum/variable-attribute-ref-ac-columns-not-working-for-re...

 


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

10 REPLIES 10

Can you post a screenshot?

I think in the other fields, you can use this field as reference qualifier if the other fields are reference.


Please mark this response as correct or helpful if it assisted you with your question.

Does my third screenshot (updated main post a few minutes ago) correspond to what you ask?

 

If Q1 is a reference field I find it in the dependant question field. If I change for Lookup Selectbox I don't see it anymore. 

 

But I found out Lookup Selectbox is limited to 10k records and there is more than 20k. 

Actually why not use ref_ac_columns in the Q1? ref_ac_columns=number,short_description

 

Reference: https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/field-admini...


Please mark this response as correct or helpful if it assisted you with your question.

Is that something I can use in a catalog item? It's not just for forms on server side?

 

I'll try to look at it tomorrow morning, but not sure were to use it in my catalog item 

Yeah...Looks like it works

https://www.servicenow.com/community/itsm-forum/variable-attribute-ref-ac-columns-not-working-for-re...

 


Please mark this response as correct or helpful if it assisted you with your question.