You need to sign in to do that
Don't have an account?
James Benson
Unable to update lead trigger because it needs a test class to reference. However, the trigger doesn't reference any test classes.
Hi,
I'm trying to update the following trigger using a changeset. However, I cannot run apex tests for a specific test class because the trigger doesn't reference one.
James
I'm trying to update the following trigger using a changeset. However, I cannot run apex tests for a specific test class because the trigger doesn't reference one.
trigger LeadDomainMatch2 on Lead (before Insert,before update) { for (Lead leadInLoop : Trigger.new) { if (leadInLoop.Domain__c != 'gmail.com' && leadInLoop.Domain__c != 'yahoo.com' && LeadInLoop.New_York__c == FALSE && LeadInLoop.New_Jersey__c == FALSE && LeadInLoop.Status == 'MQL' && LeadInLoop.Florida__c == FALSE) { // Retrieve owner from Account record based on email domain name list <Account> acct = [Select Pro_Associate_ID__c from Account WHERE Account_Email_Domain__c = :leadInLoop.Domain__c AND Account.Type = 'Customer' Limit 2]; if (acct.size() == 1) { //the next line is for debugging, to check that you are getting a result back from the query System.debug('account owner id is: ' + acct[0].Pro_Associate_ID__c); leadInLoop.OwnerId=acct[0].Pro_Associate_ID__c; } } } }How do I fix this trigger so I can deploy it to production?
James
create and check folloing test class for your trigger :
Kindly let us know if it helps you, and if it helps you close your query by choosing best answer so it helps other in future
Thanks
Hi Piyush!
I'm extremley new when it comes to apex code development (learning as I go). When I create this test class, how do I tell my trigger to reference it? Or is it as simple as creating the class, deploying the changeset that contains the trigger, and run the specific test that calls UnitTest1?
Best,
James
[open image in new tab for better view]
if your test class run successful and trigger code got more then 1% coverge, then while deploying the changeset that contains the trigger, run the specific test and give this test class name.
Thanks
Thank you - am I able to test this anywhere else but production, by chance?
James
Thanks