You need to sign in to do that
Don't have an account?
KevinRussell
Error: sObject type 'Affiliations' is not supported.
I'm trying to query against a map of local records I populated and getting the error:
Error: sObject type 'Affiliations' is not supported.
// Contact Affiliation count
RecordCount = [select count() from Affiliations where npe5__Contact__c = :record.npe5__Contact__c ];
What might I be doing incorrectly?
Thanks,
Kevin
Partial code listing:
// Create trigger for new or selected npe5__Affiliation__c record for(npe5__Affiliation__c record:trigger.new) { // Store temporary Affiliation records map< id, npe5__Affiliation__c > Affiliations = new map< id, npe5__Affiliation__c >(); // Building local list for (npe5__Affiliation__c afl : [Select Id, npe5__Contact__c, npe5__Organization__c, Type__c, npe5__Status__c, npe5__Role__c from npe5__Affiliation__c WHERE npe5__Contact__c = :record.npe5__Contact__c AND npe5__Organization__c = :record.npe5__Organization__c ] ){ Affiliations.put(afl.id, afl); } // Contact Affiliation Speaker count RecordCount = [select count() from Affiliations where npe5__Contact__c = :record.npe5__Contact__c ];
From your code is seems like the API name is "npe5__Affiliation__c"
So the query should be
RecordCount = [select count() from npe5__Affiliation__c where npe5__Contact__c = :record.npe5__Contact__c ];
Yes, give like this
RecordCount = [select count() from npe5__Affiliation__c where npe5__Contact__c = :record.npe5__Contact__c ];
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Thanks souvik9086,
But, I'm trying to querry my local Affiliations list I built so I think I want to query Affiliations, unless I'm mixing up how I reference the local map.
Can I query the Affiliations map directly?
// Store temporary Affiliation records
map< id, npe5__Affiliation__c > Affiliations = new map< id, npe5__Affiliation__c >();
// Building local list
for (npe5__Affiliation__c afl : [Select Id, npe5__Contact__c, npe5__Organization__c, Type__c, npe5__Status__c, npe5__Role__c from npe5__Affiliation__c WHERE npe5__Contact__c = :record.npe5__Contact__c AND npe5__Organization__c = :record.npe5__Organization__c ] )
{
Affiliations.put(afl.id, afl);
}
Then try something like this and let me know what happens
RecordCount = [select count() from npe5__Affiliation__c where id in :Affiliations.keyset() and npe5__Contact__c = :record.npe5__Contact__c ];
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Seems like this should be so much simpler that it is......
Thanks!!!
Error: Method does not exist or incorrect signature: [LIST<npe5__Affiliation__c>].keyset() at line 44 column 90