You need to sign in to do that
Don't have an account?
SFDC pv
I have text fied in Case(Parent) object, User will enter the number in the text field. If the number is not exists in CHILD object i should insert the record else i should not insert the record.
Map <List<String>,XXX__c > FFMap = new Map <List<String>,XXX__c> ();
List<Case> Caslist= [SELECT Id,AccountID,Number__c FROM Case WHERE ID =:CaseId ];
Set<String> xxset = new Set<String>();
for (Case cs: Caslist) {
xxset.add(cs.Number__c);
}
List<string> str = new List<string>();
for (xxx__c xxinfo: [select id,Account__c,Case__c,Number__c from XXX__c where Number__c in :xxset]) {
str.add(xxinfo.Number__c);
xxMap.put(str, xxinfo);
}
if(Cas.Number__c!=null) {
for (String num : Cas.Number__c.split(',') )
{
if(num!='' && !xxMap.containskey(num)) { // Recieving error here (Method does not exist or incorrect signature: void containskey(String) from the type Map<List<String>,XXX__c>)
}
}
}
Can someone correct me on what mistake i did in above snippet.
List<Case> Caslist= [SELECT Id,AccountID,Number__c FROM Case WHERE ID =:CaseId ];
Set<String> xxset = new Set<String>();
for (Case cs: Caslist) {
xxset.add(cs.Number__c);
}
List<string> str = new List<string>();
for (xxx__c xxinfo: [select id,Account__c,Case__c,Number__c from XXX__c where Number__c in :xxset]) {
str.add(xxinfo.Number__c);
xxMap.put(str, xxinfo);
}
if(Cas.Number__c!=null) {
for (String num : Cas.Number__c.split(',') )
{
if(num!='' && !xxMap.containskey(num)) { // Recieving error here (Method does not exist or incorrect signature: void containskey(String) from the type Map<List<String>,XXX__c>)
}
}
}
Can someone correct me on what mistake i did in above snippet.
Got the below error when i tried keyset().contains(num)
Method does not exist or incorrect signature: void contains(String) from the type Set<List<String>>
Thanks for your prompt reply . Now error is gone. But in sss same numbers are added again hence its not went inside the loop and record is not getting inserted. Please see the log below
|[41]|DEBUG|str(1913321707, 1913321707)
[43]|DEBUG|FFMap{(1913321707, 1913321707)
|[49]|DEBUG|numbers1913321707
|[54]|DEBUG|sss(1913321707, 1913321707)
|[54]|DEBUG|sss(1913321707, 1913321707, 1913321707, 1913321707)
Still same problem
|[41]|DEBUG|str(1925024562, 1925024562)
|[43]|DEBUG|FFMap{(1925024562, 1925024562)
|[47]|DEBUG|ss{(1925024562, 1925024562), (already output)}
|[51]|DEBUG|sss(1925024562, 1925024562)
|[51]|DEBUG|sss(1925024562, 1925024562, 1925024562, 1925024562)
|[56]|DEBUG|numbers1925024562