How Can I Order the Variable Name Choices in a Catalog Item Reference Qualifier on Service Portal

WazzaJC
Tera Expert

How Can I Order the Variable Name Choices within a Catalog Item Reference Qualifier Javascript

 

Dear ServiceNow Community Colleagues,

 

I am using a Lookup Select Box variable, on my catalog item, due to having variables that are dependent on another (Select Box) variable.

 

In this case, the Lookup Select Box variable is 'Functional Area' and it has a dependency on a Select Box variable, called 'Platform/Account'.

 

I have attached full screenshots for guidance, including my existing Reference Qualifier javascript, that creates the dependency.

 

My question is: what would be the adjusted Javascript to use, so as to OrderBy (show in alphabetical order) the 'platform_account' names that are presented on Service Portal, using this Lookup Select Box variable.

 

Please could I request advice/guidance on what is the adjusted Javascript I need to use within Reference Qualifier, to OrderBy 'platform_account' (which is the main Select Box variable).

 

All screenshots are attached, showing my existing configuration.

 

Many thanks for any help on achieving this.

8 REPLIES 8

Tanushree Maiti
Giga Sage

Hi @WazzaJC 

 

in variable attributes: ref_ac_order_by=<FieldName>

OR

in reference qualifier add=  javascript&colon; ORDERBY<FieldName>'

 

note: replace <FieldName> with correct field value from the referenced table on which sort needs to be added.

 

If it is not working in portal, try with variable attribute -

ref_sequence=<Field Name>

 

Ref: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0535733

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Hi @Tanushree Maiti , so how does the complete, updated Javascript look, including your suggested update? This is the current Javascript - what would be the full, correct Javascript I need to use based on your suggestion? Thanks 

javascript&colon; 'u_platform_account='+current.variables.platform_account

Hi @WazzaJC : first try with Variable attribute option.

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Hi @Tanushree Maiti it doesn't work - I tried that option already.