You need to sign in to do that
Don't have an account?
moni sha
Expecting '}' but was: 'if' at line 13 column 6
hi team,
I have below line of code but receiving below error when saving
Expecting '}' but was: 'if' at line 13 column 6
Code
Set<String>CCset = new Set<String>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
Enhancements__c AZMEE = Enhancements__c.getOrgDefaults();
List<String> emailcc = new List <String>{AZMEE.Meeting_cc__c};
if(emailcc.size() > 0)-----> error line
{
CCset.add(emailcc);
}
Could you please help on resolving the issue
I have below line of code but receiving below error when saving
Expecting '}' but was: 'if' at line 13 column 6
Code
Set<String>CCset = new Set<String>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
Enhancements__c AZMEE = Enhancements__c.getOrgDefaults();
List<String> emailcc = new List <String>{AZMEE.Meeting_cc__c};
if(emailcc.size() > 0)-----> error line
{
CCset.add(emailcc);
}
Could you please help on resolving the issue
Hi Moni,
Please Mark it as Best Answer if it helps.You can never put a List inside a set directly, please check this Code:-
Thanks
Thanks for your quick response, Tried but received the same error again.
Thanks
I think you are not getting data in this Enhancements__c AZMEE = Enhancements__c.getOrgDefaults();
you can take reference from this link
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_custom_settings.htm
https://thecodestuff.wordpress.com/2012/02/14/hierarchy-custom-settings-semantics-explained/
if you are getting data in AZMEE then copy my whole code and paste in your area.
I have tried the below code similar to above and I am not getting any error.
Please let me know it is working or not.Fundamentally there is no issue while storing Set<Strig> into List<String> or vice versa.
Here compile time error is coming due to some error before error line. I have similar issue and problem was in above for loop.