How to change the sort order of a Lookup Select Box Variable type?

Poorna7
Tera Expert

I have created a variable of Lookup Select Box type in which  look up value field(Available Shift)is a choice type field . I have used below variable attribute but it is not showing in the correct sequence as defined in the choice field:

find_real_file.png

find_real_file.png

Variable attribute:

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=office_location;date;shift_type,ref_ac_columns_search=true,ref_ac_order_by=sequence

 

find_real_file.png

 

Can someone please help how to show the timings in the dropdown sequence wise.

28 REPLIES 28

The variable type is lookup select box. Is the sorting doesn't work for choice table in it. Should I raise HI Ticket for this.

Hi,

try with simple reference qualifier only with this

javascript: 'ORDERBYsequence';

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Didn't work.

Not sure if that is supported or not then

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Okay, Thanks for the help. I am stuck in one issue can you please help what I am missing

There are 2 tables let's say one is A table which have employee and training completion check box fields

other is B table in which ticket is created when employee submit the request

My requirement was to show training completion check box field which was on A table to B table and value will be updated on the basis of A. The value of the field should not be updated through table B. The table B should only reflect the value of table A . 

I created script include and business rule which is working correctly in the scenario when record of the employee is already present in table B and ticket for the employee is created in table A post that.. When I update the field value in table B it reflect the same in table A.

It is not working in the scenario when record of the employee is not present in table B and ticket for the employee is created in table A and post that when I created a record in table B for the same employee and when I update the field in table B it doesn't update the value in table A. It is setting null.

The value in the table A should always be updated based on table B irrespective of record in table B is created before or after the table A.

Script Include:

var ORTUtils = Class.create();
ORTUtils.prototype = {
initialize: function() {},

//Given a sys_id of a user record, will return sys_id of the user's Training Info record, or "" if not found
getInfoFromID: function(userId) {
if (!userId) {
return "";
} //sanity check

var user = new GlideRecord("x_expe2_ort_training_info");
if (user.get("employee", userId)) {
return user.getUniqueValue();
} else {
return "";
}
},
type: 'ORTUtils'
};

 

Business Rule: before insert update

(function executeRule(current, previous /*null when async*/ ) {

//Set Training info reference
var trainingInfo = new x_expe2_ort.ORTUtils().getInfoFromID(current.employee); //sys_id or "" returned.
if (trainingInfo) {
current.training_info = trainingInfo; //Sys_id is return.
} else {
current.training_info = ""; //Sys_id is return.
}

 })(current, previous);

I have created the field 'Training info' on table B which is reference to Table A and by using dot walking I show the Training Completion field on table B

Table A:

 find_real_file.png

Table B : find_real_file.png