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
hamshuhamshu 

Error in Deployment process

Hi all,

 i am getting an error while deploying apex trigger and apex test class from sandbox to production   ,

 below is my trigger 

 

 

Trigger Autocreatecontactnew on Account (Before UPDATE) 
{
 set<string> st=new set<string>();
 list<Contact> listcon=new list<Contact>();
 list<Enquiry__c> listEnquiry = new list<Enquiry__c>();
 list<Account> listacc=Trigger.new;
 For(Account le:listacc)
 st.add(le.id);
 For(string s:st)
 For(Account newLead:Trigger.new)
    IF(newLead.Rcd_Type_Name__c == 'Prospect')
    IF(newLead.Auto_Create_Contact_Refence__c){
    newLead.Auto_Create_Contact_Refence__c=false;
    
    For(Account MLead:[SELECT id,name,Contact_Name__c,Lead_Source__c,Requirements_Details__c,Products_Interested_In__c,Product_Family__c,Sub_Products_Interested_In__c,Auto_Create_Contact_Refence__c,Email__c,Mobile__c,Department__c,Designation__c,Phone FROM Account Where id=:s])
   {
    listcon.add(new Contact(
    Phone=MLead.phone,
    Department=MLead.department__c,
    Designation__c=MLead.designation__c,
    LastName=Mlead.Contact_Name__c,
    Accountid=MLead.id,
    Email=Mlead.Email__c,
    MobilePhone=Mlead.Mobile__c
   ));
  listEnquiry.add(new Enquiry__c (
   
   Name=MLead.name+'-'+MLead.Products_Interested_In__c,
   Account__c=MLead.id,
   Product_Category_Description__c=MLead.Requirements_Details__c,
   Products_Interested_In__c=MLead.Products_Interested_In__c,
   Product_Family__c=MLead.Product_Family__c,
   Sub_Products_Interested_In__c=MLead.Sub_Products_Interested_In__c,
   Lead_Source__c=MLead.Lead_Source__c
 ));
}
Insert Listcon; 
Insert listEnquiry;
}
}

 

 

 

i am geting following error any help

 

API Name
Type
Line
Column
Problem

updateversionnumberTest.null() Class     Failure Message: "line 12, column 5: Field is not writeable: synthesis_Quote__c.Name", Failure Stack Trace: "null" ViewSurveyController.null() Class     Failure Message: "line -1, column -1: Previous load of class failed: updateversionnumbertest", Failure Stack Trace: "null" wrapcls2.null() Class     Failure Message: "line -1, column -1: Previous load of class failed: updateversionnumbertest", Failure Stack Trace: "null" wrapcls2Test.null() Class     Failure Message: "line -1, column -1: Previous load of class failed: updateversionnumbertest", Failure Stack Trace: "null" Autocreatecontactnew       Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required updateduedateontask       Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required updateversionnumber       Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required AutocreateShippingaddress       Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required Deploy Error      

Average test coverage across all Apex Classes and Triggers is 0%, at least 75% test coverage is required.

 

 

 

 

 

Thank,

hamshu...

Rahul_sgRahul_sg
In one of the test method you are trying to set value for synthesis_Quote__c.Name. however; it seems name field on the synthesis_Quote__c object is Auto number thats the issue you need to fix.