You need to sign in to do that
Don't have an account?
Atiqah
Illegal assignment from List<SObject> to List<ProcessInstance>
Hi, need your help for this error
Illegal assignment from List<SObject> to List<ProcessInstance> (46:31)
Illegal assignment from List<SObject> to List<ProcessInstance> (46:31)
public with sharing class ProcessInstance { @AuraEnabled(cacheable=true) public static List<ProcessInstance> getCases( String relatedTo, String submittedDate, String submittedBy ) { String query; String condition = (String.isNotBlank(relatedTo) ? 'TargetObject.name LIKE \'' + '%' + relatedTo + '%\'' : ''); condition += (String.isNotBlank(submittedDate) ? (String.isNotBlank(condition) ? +' AND ' : '') + ' LastModifiedDate LIKE \'' + '%' + submittedDate + '%\'' : ''); condition += (String.isNotBlank(submittedBy) ? (String.isNotBlank(condition) ? +' AND ' : '') + ' SubmittedBy.name LIKE \'' + '%' + submittedBy + '%\'' : ''); System.debug('condition ' + condition); if (String.isNotBlank(condition)) { query = 'SELECT TargetObject.name,LastModifiedDate,SubmittedBy.name FROM ProcessInstance WHERE ' + condition + ' ORDER BY LastModifiedDate'; } else { query = 'SELECT TargetObject.name,LastModifiedDate,SubmittedBy.name FROM ProcessInstance ORDER BY LastModifiedDate LIMIT 200'; } List<ProcessInstance> records = Database.query(query); return records; } }
I am able to sucessfully execute your code except below problem.
Your code looks good expect below line:
LastModifiedDate is data time field type so you can't use the like operator here. Like operator will works only for string.
Thanks,
Maharajan.C
Still the same, I removed submitted date, still face the error
Error