I am difficulty with regards to deploying my apex trigger and test to the product salesforce account, Can anyone help on this as it is urgent, the trigger is:
trigger LeadAssigmnent on Lead (after insert) {
List<Lead> ls = new List<Lead>();
for (Lead leadInLoop : Trigger.new) {
if(leadInLoop.LeadSource == 'Marketing')
{
ls.add(new Lead(id = leadInLoop.id));
}
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
//leadInLoop.setOptions(dmo);
Database.update(ls, dmo);
}
}
And My test Class as follows:
@isTest
private class LeadAssignmentTest {
static testMethod void leadAssignmentTest() {
// TO DO: implement unit test
//List<Id> TestlIds=new List<id>();
// Insert a new Lead record
Lead newLead = new Lead();
newLead.company='Test, Inc';
newLead.LastName='Tester';
newLead.FirstName='Testy';
newLead.Country='Russia';
newLead.Description='Test Message for Russia';
newLead.LeadSource='Marketing';
if(newLead.LeadSource == 'Marketing'){
insert newLead;
}
}
}
I am getting the following Error:
Run Failures: TestCreateProjFromOpp.runMethod System.DmlException: Insert failed. First exception on row 1; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry is inactive): [PricebookEntryId]
Can you guys please help, maybe point out what I am doing wrong on the above problem please.
Thanks in Advance.