Hello,
is it possible to have a conditional sort on multiple columns in a query rule? I need to sort the data by modified date and created date columns. Modified date might be null for some rows. Below order by expression gives just what i want when i use it with the SQL query. Is there a way of creating same logic in a query rule?
order by case when MODIFIED_DATE is null then CREATED_DATE else MODIFIED_DATE end DESC
I tried below code but it didn't help.
pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1, sort: {a!sortInfo(field: "createdDate", ascending: false), a!sortInfo(field: "modifiedDate", ascending: false)} )
Discussion posts and replies are publicly visible
If you're using a synced record type, this is also a great scenario for using a custom record field - just add a field that uses the a!defaultValue() function and returns the CREATED_DATE if MODIFIED_DATE is null. Then you can sort directly on that custom record field to achieve the result you're looking for.