<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Sort/OrderBy values in Array. in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457544#M114470</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Hopefully, this is an easy one to solve.&amp;nbsp; Just need to sort my array based on the 'sysProperty.getDisplayValue('description');'.&amp;nbsp; I have&amp;nbsp;looked at few KB articles and tried various methods but since my sorting needs to occur in or after the While loop, I am lost how to sort (orderBy) my array.&amp;nbsp; This is my 'Server Script' section of a Service Portal Widget.&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;(function () {
	data.appProperties = [];
	var sysCategory = new GlideRecord('sys_properties_category_m2m');
	sysCategory.addQuery('category','0c14fbf0db20ebc02911e525ca9619f9'); //REST API Business Services
	sysCategory.query();
	while (sysCategory.next()) {
		var appProperty = {};
			var sysProperty = new GlideRecord('sys_properties');
			sysProperty.addQuery('sys_id',sysCategory.property);
			sysProperty.query();
			while (sysProperty.next()) {
				appProperty.groupName = sysProperty.getDisplayValue('description');
				appProperty.propertyValue = sysProperty.getDisplayValue('name');
				//appProperty.orderBy(sysProperty.getDisplayValue('description'));  //Failure to sort
				//appProperty.orderBy('groupName');  //Failure to sort
			}
			//var sortList = sysProperty.orderby('appProperty.groupName');  //Failure to sort
  		    //data.appProperties.push(sortList);

		data.appProperties.push(appProperty);
		}
})();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the current look/output.&amp;nbsp; Need&amp;nbsp;to sort/orderby alphabetically on the Business Service Name column &lt;EM&gt;[sysProperty.getDisplayValue('description')]&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/163474iDAAD37847FE2C69C/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your assistance.&lt;/P&gt;
&lt;P&gt;-Wesley&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Apr 2019 19:58:16 GMT</pubDate>
    <dc:creator>Wesley Breshear</dc:creator>
    <dc:date>2019-04-29T19:58:16Z</dc:date>
    <item>
      <title>Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457544#M114470</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Hopefully, this is an easy one to solve.&amp;nbsp; Just need to sort my array based on the 'sysProperty.getDisplayValue('description');'.&amp;nbsp; I have&amp;nbsp;looked at few KB articles and tried various methods but since my sorting needs to occur in or after the While loop, I am lost how to sort (orderBy) my array.&amp;nbsp; This is my 'Server Script' section of a Service Portal Widget.&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;(function () {
	data.appProperties = [];
	var sysCategory = new GlideRecord('sys_properties_category_m2m');
	sysCategory.addQuery('category','0c14fbf0db20ebc02911e525ca9619f9'); //REST API Business Services
	sysCategory.query();
	while (sysCategory.next()) {
		var appProperty = {};
			var sysProperty = new GlideRecord('sys_properties');
			sysProperty.addQuery('sys_id',sysCategory.property);
			sysProperty.query();
			while (sysProperty.next()) {
				appProperty.groupName = sysProperty.getDisplayValue('description');
				appProperty.propertyValue = sysProperty.getDisplayValue('name');
				//appProperty.orderBy(sysProperty.getDisplayValue('description'));  //Failure to sort
				//appProperty.orderBy('groupName');  //Failure to sort
			}
			//var sortList = sysProperty.orderby('appProperty.groupName');  //Failure to sort
  		    //data.appProperties.push(sortList);

		data.appProperties.push(appProperty);
		}
})();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the current look/output.&amp;nbsp; Need&amp;nbsp;to sort/orderby alphabetically on the Business Service Name column &lt;EM&gt;[sysProperty.getDisplayValue('description')]&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/163474iDAAD37847FE2C69C/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your assistance.&lt;/P&gt;
&lt;P&gt;-Wesley&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 19:58:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457544#M114470</guid>
      <dc:creator>Wesley Breshear</dc:creator>
      <dc:date>2019-04-29T19:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457545#M114471</link>
      <description>&lt;P&gt;Have you tried to add like&amp;nbsp;&lt;STRONG&gt;sysProperty&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;orderBy&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;('description'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="token punctuation"&gt;before&amp;nbsp;sysProperty.&lt;SPAN class="token function"&gt;query&lt;/SPAN&gt;();?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If doesn't work then&amp;nbsp;maybe use&amp;nbsp;&lt;STRONG&gt;.sort()&lt;/STRONG&gt;?&lt;/P&gt;
&lt;P&gt;Here is an example of how to use it,&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.geeksforgeeks.org/javascript-array-sort/" rel="nofollow"&gt;https://www.geeksforgeeks.org/javascript-array-sort/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 20:16:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457545#M114471</guid>
      <dc:creator>bbf3562</dc:creator>
      <dc:date>2019-04-29T20:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457546#M114472</link>
      <description>&lt;P&gt;Hi bbf3562,&lt;/P&gt;
&lt;P&gt;I did with no success either and&amp;nbsp;your other example seems to work if the array has already been created or established.&amp;nbsp; I think in my case the Array is being built in the while loop.&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;while (sysCategory.next()) {
		var appProperty = {};
			var sysProperty = new GlideRecord('sys_properties');
			sysProperty.addQuery('sys_id',sysCategory.property);
		    sysProperty.orderBy('description'); 
			sysProperty.query();
			while (sysProperty.next()) {
				appProperty.groupName = sysProperty.getDisplayValue('description');
				appProperty.propertyValue = sysProperty.getDisplayValue('name');			
			}			
		data.appProperties.push(appProperty);
		}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-Wesley&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 20:56:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457546#M114472</guid>
      <dc:creator>Wesley Breshear</dc:creator>
      <dc:date>2019-04-29T20:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457547#M114473</link>
      <description>&lt;P&gt;I have two suggestions:&lt;/P&gt;
&lt;P&gt;1) there is an OOB Script Include ArrayUtil (although it does not sort)&lt;/P&gt;
&lt;P&gt;2) try orderby in your query BEFORE adding to your array&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 12:03:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457547#M114473</guid>
      <dc:creator>ggg</dc:creator>
      <dc:date>2019-04-30T12:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457548#M114474</link>
      <description>&lt;P&gt;On a similar note, move the "var appProperty = {};" inside the (inner) while loop. Best practice is to initialize the object in the scope it is going to be used.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 12:14:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457548#M114474</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2019-04-30T12:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457549#M114475</link>
      <description>&lt;P&gt;you are creating an array of json objects which you will not be able to sort.&lt;/P&gt;
&lt;P&gt;create an array of comma separated strings and you will be able to sort.&lt;/P&gt;
&lt;P&gt;data_appProperties = [];&lt;BR /&gt;var sysCategory = new GlideRecord('sys_properties_category_m2m');&lt;BR /&gt;//sysCategory.addQuery('category','0c14fbf0db20ebc02911e525ca9619f9'); //REST API Business Services&lt;BR /&gt;sysCategory.setLimit(10);&lt;BR /&gt;sysCategory.query();&lt;BR /&gt;while (sysCategory.next()) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//var appProperty = {};&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;var appProperty = '';&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var sysProperty = new GlideRecord('sys_properties');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sysProperty.addQuery('sys_id',sysCategory.property);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sysProperty.query();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;while (sysProperty.next()) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;appProperty = sysProperty.getDisplayValue('description') + ',' + sysProperty.getDisplayValue('name');&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//var sortList = sysProperty.orderby('appProperty.groupName');&amp;nbsp; //Failure to sort&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//data.appProperties.push(sortList);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data_appProperties.push(appProperty);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;gs.info(data_appProperties);&lt;BR /&gt;&lt;STRONG&gt;data_appProperties.sort();&lt;/STRONG&gt;&lt;BR /&gt;gs.info('*********************************************');&lt;BR /&gt;gs.info(data_appProperties);&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 12:36:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457549#M114475</guid>
      <dc:creator>ggg</dc:creator>
      <dc:date>2019-04-30T12:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457550#M114476</link>
      <description>&lt;P&gt;The first point made was to have the database do the sorting using the orderBy() method. When possible, it's always more efficient to have the database do the work. I'd be more interested in getting to the bottom of the "it doesn't work" statement by running the script debugger over the records retrieved when ordering that inner query by description.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 12:55:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457550#M114476</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2019-04-30T12:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457551#M114477</link>
      <description>&lt;P&gt;the inner query &lt;STRONG&gt;is&lt;/STRONG&gt; doing its job -- the inner query is &lt;STRONG&gt;inside&lt;/STRONG&gt; the outer query&lt;/P&gt;
&lt;P&gt;so, we get an ordered list of sys_properties (by&amp;nbsp; name or description) FOR EACH outer query record (m2m table)&lt;/P&gt;
&lt;P&gt;so the end result is NOT going to be in name or description order&lt;/P&gt;
&lt;P&gt;looks to me like you HAVE to order the array AFTER it is completed by array.sort()&lt;/P&gt;
&lt;P&gt;and I believe you would have to use strings to sort (sort on a json object property.value possible)?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 13:40:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457551#M114477</guid>
      <dc:creator>ggg</dc:creator>
      <dc:date>2019-04-30T13:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457552#M114478</link>
      <description>&lt;P&gt;Try the below script,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;while (sysCategory.next()) {&lt;BR /&gt;&amp;nbsp; var appProperty = {};&lt;BR /&gt;&amp;nbsp; var sysProperty = new GlideRecord('sys_properties');&lt;BR /&gt;&amp;nbsp; sysProperty.addQuery('sys_id',sysCategory.property);&lt;BR /&gt;&amp;nbsp; sysProperty.orderBy('description'); &lt;BR /&gt;&amp;nbsp; sysProperty.query();&lt;BR /&gt;&amp;nbsp; while (sysProperty.next()) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; appProperty.groupName = sysProperty.getDisplayValue('description');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; appProperty.propertyValue = sysProperty.getDisplayValue('name');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;data.appProperties.push(appProperty);&lt;BR /&gt;&amp;nbsp; } &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;I have put the data.appProperties.push(appProperty); inside the while loop so that sorted values are passed to data array.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 13:40:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457552#M114478</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2019-04-30T13:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457553#M114479</link>
      <description>&lt;P&gt;Thanks Chuck,&lt;/P&gt;
&lt;P&gt;Made change your change with no impact and still get the un-alphabetized list.&lt;/P&gt;
&lt;P&gt;-Wesley&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 15:00:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457553#M114479</guid>
      <dc:creator>Wesley Breshear</dc:creator>
      <dc:date>2019-04-30T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457554#M114480</link>
      <description>&lt;P&gt;Hi GGG,&lt;/P&gt;
&lt;P&gt;Here is the output to the log file and sorting didn't occur.&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;DAS-ChatOps (P),cmdb_ci_service.chatops,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;DAS-IAMMob (P),cmdb_ci_service.iammob,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;DAS-ContReg (P),das.cmdb_ci_service.contreg,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;DAS-Mail (P),das.cmdb_ci_service.mail,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;Helix Forecaster API (P),cmdb_ci_service.helix_forecaster_api,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;Helix Turbulence API (P),cmdb_ci_service.helix_turbulance_api,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;DAS-RDG (P),cmdb_ci_service.rdg,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;Bifrost Commands API (P),cmdb_ci_service.bifrost_commands_api,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;Bifrost Storage API (P),cmdb_ci_service.bifrost_storage_api,&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;DAS-Egate (P),cmdb_ci_service.egate&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other ideas?&lt;/P&gt;
&lt;P&gt;-Wesley&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 15:04:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457554#M114480</guid>
      <dc:creator>Wesley Breshear</dc:creator>
      <dc:date>2019-04-30T15:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457555#M114481</link>
      <description>&lt;P&gt;Hi Surajp,&lt;/P&gt;
&lt;P&gt;No success.&amp;nbsp; Breaks the script and no values display.&amp;nbsp; I followed Chucks advice above and your solution then works but still not sorting.&lt;/P&gt;
&lt;P&gt;Any other ideas?&lt;/P&gt;
&lt;P&gt;-Wesley&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 15:18:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457555#M114481</guid>
      <dc:creator>Wesley Breshear</dc:creator>
      <dc:date>2019-04-30T15:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sort/OrderBy values in Array.</title>
      <link>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457556#M114482</link>
      <description>&lt;P&gt;var data_appProperties = [];&lt;BR /&gt;var sysCategory = new GlideRecord('sys_properties_category_m2m');&lt;BR /&gt;//sysCategory.addQuery('category','0c14fbf0db20ebc02911e525ca9619f9'); //REST API Business Services&lt;BR /&gt;//sysCategory.setLimit(10);&lt;BR /&gt;sysCategory.query();&lt;BR /&gt;while (sysCategory.next()) {&lt;BR /&gt; &lt;BR /&gt; var sysProperty = new GlideRecord('sys_properties');&lt;BR /&gt; sysProperty.addQuery('sys_id',sysCategory.property);&lt;BR /&gt; sysProperty.orderBy('description');&lt;BR /&gt; sysProperty.query();&lt;BR /&gt; while (sysProperty.next()) {&lt;BR /&gt; var appProperty;&lt;BR /&gt; appProperty = sysProperty.getDisplayValue('description') + ',' + sysProperty.getDisplayValue('name');&lt;BR /&gt; data_appProperties.push(appProperty);&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; }&lt;BR /&gt; for(var i = 0; i&amp;lt;=data_appProperties.length-1; i++){&lt;BR /&gt; gs.info(data_appProperties[i]);&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;data_appProperties.sort()&lt;/P&gt;
&lt;P&gt;gs.info('*********************************************');&lt;BR /&gt;for(var j = 0; j&amp;lt;=data_appProperties.length-1; j++){&lt;BR /&gt; gs.info(data_appProperties[j]);&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//BEFORE SORT&lt;/P&gt;
&lt;PRE&gt;*** Script: Number of security questions required during the password reset request,password_reset.qa.num_reset&lt;BR /&gt;*** Script: Require authentication for user signature.,com.snc.assessment.signature_authentication&lt;BR /&gt;*** Script: Work notes icon used in Task Activity formatter.,glide.ui.incident_activity.image.work_notes&lt;BR /&gt;*** Script: Copy attachments from originating incident,com.snc.incident.copy.attach&lt;BR /&gt;*** Script: Escalation rule which applies when Shifts overlap. Setting are - [start: Escalate to outgoing Shift, end: Escalate to incoming Shift, all: Escalate to all Shifts].,com.snc.on_call_rotation.escalation_rule_rota_overlap&lt;BR /&gt;*** Script: Show breadcrumbs for the categories associated with items when they are displayed in browse and search listings,glide.sc.show_listing_breadcrumbs&lt;BR /&gt;*** Script: Logging level for TaskSLAController (default: Notice),com.snc.sla.task_sla_controller.log&lt;BR /&gt;*** Script: When filters are changed the graph will recalculate the layout using the currently selected layout algorithm,glide.ngbsm.filters_run_layout_automatically&lt;BR /&gt;*** Script: Maximum number of widgets that can render simultaneously on a responsive dashboard,glide.canvas.grid.widget_render_concurrent_max&lt;BR /&gt;*** Script: Show approvers when displaying workflow stages with the Linear renderer.,glide.workflow.renderer.linear.show_approver&lt;BR /&gt;*** Script: *********************************************&lt;BR /&gt;&lt;BR /&gt;//AFTER SORT&lt;BR /&gt;&lt;BR /&gt;*** Script: Copy attachments from originating incident,com.snc.incident.copy.attach&lt;BR /&gt;*** Script: Escalation rule which applies when Shifts overlap. Setting are - [start: Escalate to outgoing Shift, end: Escalate to incoming Shift, all: Escalate to all Shifts].,com.snc.on_call_rotation.escalation_rule_rota_overlap&lt;BR /&gt;*** Script: Logging level for TaskSLAController (default: Notice),com.snc.sla.task_sla_controller.log&lt;BR /&gt;*** Script: Maximum number of widgets that can render simultaneously on a responsive dashboard,glide.canvas.grid.widget_render_concurrent_max&lt;BR /&gt;*** Script: Number of security questions required during the password reset request,password_reset.qa.num_reset&lt;BR /&gt;*** Script: Require authentication for user signature.,com.snc.assessment.signature_authentication&lt;BR /&gt;*** Script: Show approvers when displaying workflow stages with the Linear renderer.,glide.workflow.renderer.linear.show_approver&lt;BR /&gt;*** Script: Show breadcrumbs for the categories associated with items when they are displayed in browse and search listings,glide.sc.show_listing_breadcrumbs&lt;BR /&gt;*** Script: When filters are changed the graph will recalculate the layout using the currently selected layout algorithm,glide.ngbsm.filters_run_layout_automatically&lt;BR /&gt;*** Script: Work notes icon used in Task Activity formatter.,glide.ui.incident_activity.image.work_notes&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 15:46:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/sort-orderby-values-in-array/m-p/1457556#M114482</guid>
      <dc:creator>vkachineni</dc:creator>
      <dc:date>2019-04-30T15:46:20Z</dc:date>
    </item>
  </channel>
</rss>

