function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jason Harris 45Jason Harris 45 

Using triggers to look up or validate information entered in a custom field

Hello, I am trying to use a trigger to check or validate information in a Case custom field.   I have a list of data(serial numbers), I want to see if a serial number entered into my custom serial number field in the list of serial number i have.  If it is in the list, I want a notifiaction that it is on the list.   I was told a trigger may help me with this.  Can someone point me in the right direction?
AbhishekAbhishek (Salesforce Developers) 
Hi Jason,

I hope your query answered in this blog,

https://developer.salesforce.com/forums/?id=906F0000000907gIAA

Please go through it.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Jason Harris 45Jason Harris 45
Thanks, It may have helped. I do have an error, that I do not know how to resolve. Here is what I have written and the error [image: Error] Error: Compile Error: Expecting '}' but was: '' at line 21 column 1 [image: image.png] trigger SerialNumber on Case (after insert, after update) { List SerialList = new List(); for (Case a:Trigger.new) { SerialList.add(a.Serial_number_Full_list__c); } List SerialNum = [Select Name from custom_serial_number__c where Name in :SerialList]; if (SerialNum.size() > 0 ){ for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.new[i].Serial_number_Full_list__c != null) { Trigger.new[i].custom_serial_number__c = SerialNum[i].ID; } else { Trigger.new[i].custom_serial_number__c = null; } Kind regards, Jason Harris Viessmann Manufacturing Company Inc. 750 McMurray Road Waterloo, ON N2V 2G5 To serve you better please call us on the toll-free “Viessmann TechInfo Line” for all calls relating to Viessmann Heating Products. Or refer to the “Pro Login” section of our website for detailed Product Literature & Parts Catalog. TechInfo Line: 888-484-8643 Fax: 519-772-1023 Email: HJa@viessmann.com Website: www.viessmann.ca Pro Login: http://www.viessmann.ca/en/service/Login.html
AbhishekAbhishek (Salesforce Developers) 
Jason Try this,

https://trailhead.salesforce.com/help?support=home#
Jason Harris 45Jason Harris 45
I am not sure how that link helps Kind regards, Jason Harris Viessmann Manufacturing Company Inc. 750 McMurray Road Waterloo, ON N2V 2G5 To serve you better please call us on the toll-free “Viessmann TechInfo Line” for all calls relating to Viessmann Heating Products. Or refer to the “Pro Login” section of our website for detailed Product Literature & Parts Catalog. TechInfo Line: 888-484-8643 Fax: 519-772-1023 Email: HJa@viessmann.com Website: www.viessmann.ca Pro Login: http://www.viessmann.ca/en/service/Login.html
AbhishekAbhishek (Salesforce Developers) 
Jason there is no Offical documentation for your requirement.

You can go through the blog and try the code,

https://developer.salesforce.com/forums/?id=906F0000000907gIAA

But you have to make changes based on your requirements.
Jason Harris 45Jason Harris 45
But what about the error that I have. What caused the error and how do I correct it? Kind regards, Jason Harris Viessmann Manufacturing Company Inc. 750 McMurray Road Waterloo, ON N2V 2G5 To serve you better please call us on the toll-free “Viessmann TechInfo Line” for all calls relating to Viessmann Heating Products. Or refer to the “Pro Login” section of our website for detailed Product Literature & Parts Catalog. TechInfo Line: 888-484-8643 Fax: 519-772-1023 Email: HJa@viessmann.com Website: www.viessmann.ca Pro Login: http://www.viessmann.ca/en/service/Login.html
AbhishekAbhishek (Salesforce Developers) 
Jason as mentioned earlier you have to change the code based on functionality.
Jason Harris 45Jason Harris 45
Are you able to direct me to someone who can tell me what the error means and why it occured Kind regards, Jason Harris Viessmann Manufacturing Company Inc. 750 McMurray Road Waterloo, ON N2V 2G5 To serve you better please call us on the toll-free “Viessmann TechInfo Line” for all calls relating to Viessmann Heating Products. Or refer to the “Pro Login” section of our website for detailed Product Literature & Parts Catalog. TechInfo Line: 888-484-8643 Fax: 519-772-1023 Email: HJa@viessmann.com Website: www.viessmann.ca Pro Login: http://www.viessmann.ca/en/service/Login.html
AbhishekAbhishek (Salesforce Developers) 
Sorry, jason I don't have any other references.
Jason Harris 45Jason Harris 45
Just to be clear. Sales Force can not explain an error that I received, while trying to code in APEX. As I understand APEX is a sales force code. Sales Force can not explain what an error code means in their own software. Am I understanding you correctly? Kind regards, Jason Harris Viessmann Manufacturing Company Inc. 750 McMurray Road Waterloo, ON N2V 2G5 To serve you better please call us on the toll-free “Viessmann TechInfo Line” for all calls relating to Viessmann Heating Products. Or refer to the “Pro Login” section of our website for detailed Product Literature & Parts Catalog. TechInfo Line: 888-484-8643 Fax: 519-772-1023 Email: HJa@viessmann.com Website: www.viessmann.ca Pro Login: http://www.viessmann.ca/en/service/Login.html
AbhishekAbhishek (Salesforce Developers) 
Jason, you are taking it in the wrong way. It is a code issue, not a platform issue.

If you want to fulfill your requirement you have to hire a full pledge developer.
Jason Harris 45Jason Harris 45
I understand its a code issue. I need to know what is the meaning of the error code. The error code was generated from the platform because I missed something in the APEX coding. I just need the error code explained to me, so I can correct it Kind regards, Jason Harris Viessmann Manufacturing Company Inc. 750 McMurray Road Waterloo, ON N2V 2G5 To serve you better please call us on the toll-free “Viessmann TechInfo Line” for all calls relating to Viessmann Heating Products. Or refer to the “Pro Login” section of our website for detailed Product Literature & Parts Catalog. TechInfo Line: 888-484-8643 Fax: 519-772-1023 Email: HJa@viessmann.com Website: www.viessmann.ca Pro Login: http://www.viessmann.ca/en/service/Login.html
AbhishekAbhishek (Salesforce Developers) 
Jason if it a standard error I can guide with something.

If it is customer error you have to setup debug logs and need to narrow down the code where you are seeing the issue.
Jonye KeeJonye Kee
I have a list of data(serial numbers), I want to see if a serial Site web gratuit Suisse (https://ks-digital.ch/) number entered into my custom serial number field in the list of serial number i have.