You need to sign in to do that
Don't have an account?
Bob
Quote Trigger Help
I am trying to figure out how to write a trigger/apex class that would look through a list of quotes. There is a checkbox (Primary_Quote__c) I need the trigger or class to look through the list of quote. There is a custom field Entitled (Oracle_Quote__c). I need the trigger to look through the list of quotes with the same Oracle Quote Number and automatically check the Primary Quote checkbox on the record with the newest created date, and also uncheck the older quote records. Is this possible? How would I accomplish? Any helpwuold be greatly appreicated.
Here, is one time script to update the existing records. You can run this script in the developer console. Try, to run this is sandbox first (to avoid any issues), though I have tested it and it seems to be working fine.
You may have to adjust the code a bit, I have assumed 'Oracle_Quote__c' is a decimal field, change accordingly. You can cut and paste this trigger on Quote, it will handle the future records automatically. I advise you to test above both in Sanbox first, then deply to production.
Please, let me know if you need any help.
Thanks,
Sumit Kumar Singh
All Answers
How many Quote records are ther in Org? Is it more than 50K ?
Yes, we can achieve this. Pls, let me know the number of quotes records, then I can provide you the appropriate solution.
Thanks,
Sumit Kumar Singh
Here, is one time script to update the existing records. You can run this script in the developer console. Try, to run this is sandbox first (to avoid any issues), though I have tested it and it seems to be working fine.
You may have to adjust the code a bit, I have assumed 'Oracle_Quote__c' is a decimal field, change accordingly. You can cut and paste this trigger on Quote, it will handle the future records automatically. I advise you to test above both in Sanbox first, then deply to production.
Please, let me know if you need any help.
Thanks,
Sumit Kumar Singh
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger Trigger_PrimaryQuoteCheckbox caused an unexpected exception, contact your administrator: Trigger_PrimaryQuoteCheckbox: execution of BeforeInsert caused by: line 17, column 1: Illegal empty right operand for operator '>=' in query 'null'.