- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I would like to hard code my already cloned widget to order by a field that is a reference field on the data.table
I found this online so I understand where I need to update this, but WHAT do I update data.o to?
The line data.o = data.o || $sp.getValue('order_by'); is a JavaScript expression commonly found in ServiceNow Service Portal widgets. It is used to set a value for the order_by property within the data object, which is typically used to pass information between the client-side and server-side scripts of a widget.
data.o = <table name>.<field>.<field>?
So it would be the actual name of the table, then the reference field and then the field on the referenced field? x_g_table.actualreferencefieldname.field?
Solved! Go to Solution.
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
It would be like dot-walking, correct.
In a URL, it would be o=caller_id.last_name, for args with an widget:
data.o = 'caller_id.last_name' 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @kemmy1 ,
You would use the field name for the table. For example, to order by priority on incident, you would use the field name 'priority'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
But what if (in my case), I need to sort on, let's say a field on a reference field of the incident form. Specifically, a field on the referenced table. So (just an example) incident.user.email? so data.o = data.table.user.email?
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
It would be like dot-walking, correct.
In a URL, it would be o=caller_id.last_name, for args with an widget:
data.o = 'caller_id.last_name'- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
That worked! Thank you!
