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.

Sort change tasks by order field

Justin Clarke
Tera Guru

Hi,

 

I have a copy of the normal change workflow that i am creating different tasks based on the category used. 

I have been able to get the tasks to be created and set the order field on each of these which uses a seperate task workflow. The requirement is to use parellel rather than sequential.

However, i cannot seem to find where the set the default sort order of change tasks to the Order field.

Need to do this on default and SOW as a default

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

If I'm following, it sounds like maybe you want the default sort order of the Change Task Related List in the native UI and SOW to be on the Order field instead of Task Number.  To do this, create a User Preference record via User Preferences on the left nav.

BradBowman_0-1763947648971.png

'order' in the name stands for sort order, whereas the Value = 'order' is the name of the field you want the sort order to be based on.  Checking the System box will make this the default for all users.  This record applies to both interfaces.  If you want the sort order to be descending, create another preference with the Name = change_task.db.order.direction with the Value = DESC

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

If I'm following, it sounds like maybe you want the default sort order of the Change Task Related List in the native UI and SOW to be on the Order field instead of Task Number.  To do this, create a User Preference record via User Preferences on the left nav.

BradBowman_0-1763947648971.png

'order' in the name stands for sort order, whereas the Value = 'order' is the name of the field you want the sort order to be based on.  Checking the System box will make this the default for all users.  This record applies to both interfaces.  If you want the sort order to be descending, create another preference with the Name = change_task.db.order.direction with the Value = DESC

kaushal_snow
Giga Sage

@Justin Clarke ,

 

1st way: you can set User Preferences (system level) so that for all users the related list sort is by order: create preferences for change_task.db.order = order and change_task.db.order.direction = ASC or DESC.

 

2nd way: You can create a Before Query Business Rule on change_task that adds an encoded query like "ORDERBYorder" so that whenever tasks are fetched in a related list context, they're sorted by the order field.

 

If you only want this sort for Change > Change Tasks and not globally, a better option might be using a Defined Relationship (System Definition > Relationships) for the related list, where you can specify the default sort on the relationship itself....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Justin Clarke
Tera Guru

Thanks for the replies. Was able to use the first option with user preferences and that worked.