"Order By" or "Sort" missing in Flow Designer "Look Up Records" action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 06:15 AM
I'm developing a flow in Madrid, and need to process a set of records in a particular order.
When using the core "Look Up Records" action, I can define the Condition and Max Results, but can't find where I can specify an order in which the records are processed. In other words, what will mimic gliderecord.orderBy.
Feels to me like a valid Enhancement request in HI (if it really doesn't exist - I could be overlooking it). I did a quick scan thru HI's Enhancements and didn't see any.
Thanks.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2020 04:36 AM
There is an error which might cause the actions 'Look up records' and 'Look up record' to miss the order by and sort type fields. You might want to contact HI support to provide a fix for the issue, but if you're comfortable reading the configuration tables and using background scripts to edit them, you can try following these steps:
1) In table sys_hub_action_type_definition find the record with name 'Look up records'.
2) See the record's values for fields master_snapshot and latest_snapshot. If the action is missing 'order by' field, most likely the value in master_snapshot is empty. Copy the sys_id of this record to notepad.
3) In the snapshot table sys_hub_action_type_snapshot find records with name 'Look up records'.
4) Of these snapshots, find the latest creation timestamp where the related list 'Action inputs' match the action's documentation on the version of ServiceNow you're running. For example, in Orlando, we're expecting to find five rows: Table, Conditions, Order by, Sort Type, Max Results. Copy the sys_id of this record to notepad
5) With background script, modify the relevant record in sys_hub_action_type_definition field master_snapshot and latest_snapshot to contain the sys_id of the sys_hub_action_type_snapshot where you found the correct set of 'Action inputs'.
6) If necessary, repeat the same for 'Look up record' action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 04:09 AM
Thank you for providing the workaround. In the meantime, our instance has been upgraded to New York. This version provides Order By for both Look Up Record and Look Up Records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2021 02:40 AM
Had same issue in Orlando.
Your solution worked for me, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2021 02:50 AM
This is the script (run it via System Definition - Scripts Background):
var record_to_fix = new GlideRecord('sys_hub_action_type_definition');
record_to_fix.addQuery('sys_id', "sys_id from step2");
record_to_fix.query();
while (record_to_fix.next()) {
record_to_fix.setValue('master_snapshot', "sys_id from step4");
record_to_fix.setValue('latest_snapshot ', "sys_id from step4");
record_to_fix.update();
}