You need to sign in to do that
Don't have an account?
About Apex class
Hello newbie here. I am not able to show the error from my Custom Label. Can anyone help me? Thank you so much!
//here is my Code
public class MyClassHandler {
public static void caseValidation(List<Case> caseList){
caseList = [SELECT Id, AccountId, Account.Client_Type__c from Case];
Set<Id> caseId = new Set<Id>();
for(Case caseStorage : caseList){
caseId.add(caseStorage.AccountId);
//system.debug('Result' + caseStorage.Id);
if(caseStorage.Account.Client_Type__c == 'Silver' && caseId.size() <= 3){
caseStorage.addError(System.Label.SilverError); //error message
}
}
}
}
//Here on the image is the main error I want to remove
I don't see any issue with the syntax of accessing the custom label.
Can you please let me know what exactly you are trying to achieve in the above scenerio.
Thanks,
Hi Sai,
I want to show the error message from my Custom Label on New Case form.
Thanks,
Nec
I did not understood the logic above. In which scenerio you want the error message to be shown . I hope this is a trigger handler. Can you please elobrate the requirement .
Thanks,
Hi,
Please find the solution. You can take references from the below code.
Please mark it as the Best Answer so that other people would take references from it.
Thank You
Hi Sai,
This is the scenario, I have 2 clients the Silver and Gold, the Silver takes 1 case only then the Gold takes 3 cases only.
Now if my selected client is Silver, I am allowed to create 1 case only, then if I try to create another 1 or more than 1 case for Silver,
the error message from my custom label will appear, and yes I am using trigger.
Thanks,
Nec
Hi Suraj,
Sure, no worries.
Thanks,
Nec
Hello,
Additional, the Clients are from Account object.
Thanks,
Nec