Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Contract Management - Renew Modal - Renewal_option choices

Chidler85
Tera Contributor

Within the Contract management module we are adding some additional options to the Renewal Options field.

We have added a new choice of 5 years to the dictionary, and updated the relevant UI Page (contract_renew_popup) for this modal to show the new option.

 

Everything is looking and working as expected in native UI view:

 

Screenshot 2025-10-27 151022.png


but when looking at the same contract in the Hardware Asset Workspace - the modal has the new '5 Years' option not in the correct order:

 

Screenshot 2025-10-27 151136.png

Can anyone help me with this?

3 REPLIES 3

lauri457
Giga Sage

Updating the sequence to 4 (or to highest value in choices) for the new 5 years sys_choice in the dictionary will likely do the trick

Thanks, It is already set to 4 but still not showing in as the last option in the Workspace view of the Renew Modal.

Checked this in the ham simulator learning course on xanadu and sn_itam_workspace v 6.0.1

 

This here is the data resource that provides the options

 https://[instance].service-now.com/nav_to.do?uri=sys_ux_data_broker_transform.do?sys_id=b09aa0fda3b1011021fd885716fcda14

 

This is the script include that the data resource uses 

https://[instance].service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=c86a8b6b531170103676ddeeff7b123e

 

The data resource just returns an array with whatever ordering the gliderecord/glidequery defaults to on the sys_choice table. Mine was different to your screenshot. Best way to fix is straight at the source by adding an order by sequence in the query in the script include.

var AssetWorkspaceUtil = Class.create();
AssetWorkspaceUtil.prototype = {
....
	getRenewOptions: function () {
		var current_language = AssetWorkspaceUtil.getSessionLanguage();
		var results = [];
		results.push({
			id: 'none',
			value: '',
			label: gs.getMessage('-- None --'),
		});
		new global.GlideQuery('sys_choice')
			.orderBy("sequence")                              // << add order by sequence
			.where('name', 'ast_contract')
			.where('element', 'renewal_options')
			.where('language', current_language)
			.select('value', 'sys_id', 'label')
			.forEach(function (option) {
				var options = {};
				options.id = option.value;
				options.value = option.value;
				options.label = option.label;
				results.push(options);
			});
		return results;
	},

lauri457_0-1761694854576.png