Symptoms
Calling the OpenWorklist method wit ha filter that sorts on a Date data field, causes the following error: 1 Invalid cast from 'Int64' to 'DateTime'
Diagnoses
This is because the data field was defined as "Data-On-Demand" (DOD) during creation. DOD fields ARE NOT returned by a Worklist retrieval via the API. Trying to sort on date data fields which are not returned, causes the casting problem. (This is by design.)
Resolution
After editing the data field, unchecking the "Data-on-demand" checkbox and redeploying the process,the OpenWorklist method (With the sort on the date data field) works as expected.