You need to sign in to do that
Don't have an account?
Jim Parker 7
Invalid Initial Value Type List for List - Compile Error
Getting a compile error - Invalid Initial Value Type List for List. Line 14 (commented below). In essence, I have a trigger on dsfs__DocuSign_Status__c. dsfs__DocuSign_Status__c has a field dsfs__Case__c which is an ID of a case. Anytime the trigger occurs, I want to set the "Status" field on the case identified by dsfs__Case__c to newStatus. Any thoughts on what I am doing wrong?
public class DocusignStatusUtil { public static void updateCaseStatus (List<dsfs__DocuSign_Status__c> envelopes, String newStatus) { try { Set<Id> st_ParentId = new Set<Id>(); for(dsfs__DocuSign_Status__c envelopesEvaluated : envelopes) { st_ParentId.add(envelopesEvaluated.dsfs__Case__c); } List<Id> relatedCasesMap; if(st_ParentId!=null && !st_ParentId.isEmpty()) { //this is where the error is relatedCasesMap = new List<Id>([SELECT Id FROM Case WHERE Id IN :st_ParentId limit 1]); } for (dsfs__DocuSign_Status__c envelopesEvaluated : envelopes) { if(relatedCasesMap!=null && relatedCasesMap.containsKey(envelopesEvaluated.dsfs__Case__c)) { relatedCasesMap.get(envelopesEvaluated.dsfs__Case__c).Status = newStatus; } } if(relatedCasesMap!=null && relatedCasesMap.values()!=null) update relatedCasesMap.values(); } catch (Exception e) { System.debug('Issue with the Horizon Case Update: ' + e.getMessage()); } } }
Hi Jim,
Below is code snippet, It will help you :)
Please let me know, the result after utilize this code
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
All Answers
Your SELECT query will not return a List<Id> as your declaration, but a List<Case>
That is why you get this error. Change your variable declaration to List<Case>, or even better to Map<Id,Case>
Hi Jim,
Below is code snippet, It will help you :)
Please let me know, the result after utilize this code
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com