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
Nitesh AgarwalNitesh Agarwal 

Change Set Issues

Dear All,

Greetings of the day!

I am facing couple of issues with change set, as I am doing it first time. I tried creating inbound and outbound change set and have included all parts of new development on Sandbox. 

Still when I validate it on Production, it comes up with errors.
Would you be able to guide me out on how to get through it?

Attached below are the images from sandbox and production. 

Outbound Change Set is in Sandbox
Inbound Change Set is in Produciton

User-added image


User-added image

User-added image


Apex Controller class is 


public class customPickListInVFDemoController {
    public String Country { get; set; }
    public String City{ get; set; }
    public String Suburb { get; set; }
    public String ClientSuburb { get; set; }
    public String State { get; set; }
    public String PostCodes { get; set; }
    public String ClientState { get; set; }
    public String ClientPostCodes { get; set; }
    public Address_Details__c address { get; private set; }
    public Client__c client { get; private set; }
    public String AddrId {get; set;}
    public Id clientId;
   // public List<SelectOption> detailOptions{ get; set; }
   // public String details { get; set; }
    public Boolean bRenderDetail {get; set;}

 
//   TODO:  rename getCountriesOptions to getPostcodeOptions
    public List<SelectOption> getPostCodeOptions()
    {
         Set<String> distintList = new Set<String>();

        List<SelectOption> postCodeOptions = new List<SelectOption>();
        postCodeOptions.add(new SelectOption('','-None-'));
        for (Address_Details__c addr: [SELECT Post_Code__c FROM Address_Details__c order by Post_Code__c ])
        {
           if(distintList.Contains(addr.Post_Code__c)== FALSE)
           {
              distintList.add(addr.Post_Code__c);
             postCodeOptions.add( new SelectOption(addr.Post_Code__c , addr.Post_Code__c));
            }
        }
              return postCodeOptions;
     }
     public List<SelectOption> getSuburbsOptions() 
     {
            Set<String> distintList = new Set<String>();
        List<SelectOption> SuburbOptions = new List<SelectOption>();
        SuburbOptions.add(new SelectOption('','-None-'));
        for (Address_Details__c addr: [SELECT Suburb_Name__c FROM Address_Details__c order by Suburb_Name__c])
        {
        if(distintList.Contains(addr.Suburb_Name__c)== FALSE)
           {
               distintList.add(addr.Suburb_Name__c);

          SuburbOptions.add( new SelectOption(addr.Suburb_Name__c , addr.Suburb_Name__c));
          }
        }
        return SuburbOptions;
      }
    
    
 
    public customPickListInVFDemoController(ApexPages.StandardController stdController) 
    {
            this.client = (Client__c)stdController.getRecord();
            Id id = ApexPages.currentPage().getParameters().get('id');
            client = (id == null) ? new Client__c() : 
            [SELECT Street_Address__c, Suburb__c, State__c, Postcode__c FROM Client__c WHERE Id = :id];
    }
  
    public PageReference save()
    {
      try 
      {
           update(client);
           }
      catch(System.DMLException e) 
      {
      ApexPages.addMessages(e);
        return null;
      }
      

       //  After Save, navigate to the default view page:
          return (new ApexPages.StandardController(client)).view();
          }
 
    public void onChangePostCode() 
     {
           //PostCodes= client.Postcode__c;
          
           Suburb ='';
           bRenderDetail =true;
      }
      public void onChangeSuburb() 
      {
           PostCodes ='';
         // Suburb =client.Suburb__c;
bRenderDetail= true;

       }    

   public void onchangeDetails() 
      {
           this.address = new Address_Details__c ();
           address = [SELECT Country_Name__c, Suburb_Name__c, City_Name__c, State_Name__c, Post_Code__c FROM Address_Details__c WHERE id= :AddrId];
           client.Suburb__c= address.Suburb_Name__c ;
           client.State__c= address.State_Name__c ;
           client.Postcode__c= address.Post_Code__c ;
           bRenderDetail=false;
      
    }
    public List<SelectOption> getPopulatePostCodeSuburbList()
    {
        List<SelectOption> detailOptions = new List<SelectOption>();
         //detailOptions.add(new SelectOption('','-None-'));
        if(PostCodes!='')
        {
          for (Address_Details__c addr: [SELECT id, Suburb_Name__c, City_Name__c, State_Name__c, Post_Code__c FROM Address_Details__c WHERE Post_Code__c= :PostCodes])
          {
            string  details = addr.State_Name__c + '-' + addr.City_Name__c + '-' + addr.Suburb_Name__c + + '-' + addr.Post_Code__c;
           
             detailOptions.add( new SelectOption(addr.id , details));
           }
        }
        else if (Suburb!='')
       {
          for (Address_Details__c addr: [SELECT id, Suburb_Name__c, City_Name__c, State_Name__c, Post_Code__c FROM Address_Details__c WHERE Suburb_Name__c= :Suburb])
          {
             string details = addr.State_Name__c + '-' + addr.City_Name__c + '-' + addr.Suburb_Name__c + + '-' + addr.Post_Code__c;
           
             detailOptions.add( new SelectOption(addr.id , details));
          }
        }
        

        return detailOptions;

    }
   }




Test Class to Controller is


@isTest
 public class customPickListInVFDemoControllerTest
 {
    public static testmethod void testcustomPickListInVFDemoController()
    {
         
           // Create sample data.
           Client__c client = new Client__c ();
           client.Client_Family_Name__c = 'Testclientfamilyname';
           client.Given_Names__c = 'Testclientgivenname';
           client.Street_Address__c = '5 Osborne Avenue';
           client.Suburb__c = 'Springvale';
           client.Postcode__c = '3171';
           client.State__c = 'VIC';
           insert client;
  
    } 
}



And the Visual Force page code is 

User-added image



Your help will be highly appreciated


Thanks
Nitesh
Eswar Prasad@Sfdc11Eswar Prasad@Sfdc11
hi Nitesh,
In your test class not getting 75% code coverage,thus why getting a error i can modified test class pls see below code now its work fine.

@isTest
 public class customPickListInVFDemoControllerTest
 {
    public static testmethod void testcustomPickListInVFDemoController()
    {
         
           // Create sample data.
           Client__c client = new Client__c ();
           client.Client_Family_Name__c = 'Testclientfamilyname';
           client.Given_Names__c = 'Testclientgivenname';
           client.Street_Address__c = '5 Osborne Avenue';
           client.Suburb__c = 'Springvale';
           client.Postcode__c = '3171';
           client.State__c = 'VIC';
           insert client;

ApexPages.StandardController std=new ApexPages.StandardController(client);
  CustomPicklistInVfDemoController exten=new CustomPicklistInVfDemoController(std);
  List<SelectOption> pc= exten.PostCodeOptions();
  List<SelectOption> so= exten.SuburbsOptions()
  List<SelectOption> ppc= exten.PopulatePostCodeSuburbList()
  exten.save();
  exten.onChangePostCode();
  exten.onchangeDetails();

  
  
    } 
}
Nitesh AgarwalNitesh Agarwal
Hi Eswar,

Thanks for your updates!

I have updated the test class as given in yor reply with a minor changes in the name of the methods you have give. They were not the method I have used in my apex class.

However, When I Test Run it, on sandbox, it did not pass the test.

Error Message  System.QueryException: List has no rows for assignment to SObject
Stack Trace     Class.customPickListInVFDemoController.onchangeDetails: line 100, column 1
                       Class.customPickListInVFDemoControllerTest.testcustomPickListInVFDemoController: line 24, column 1


Here is the detail of the funtionality.

There are two objects Client object and Address Detail object. 

Client object is having all the details related to clients including their address
Address Detail just have Suburbs, Post Code, City, and State fields

User click a button on client page which opens up a VF page that will have the existing address detail of the client and that page also has the fucntionality to select either a suburb or postcode from  list and then they will have all the other related details in one list box. When user select any of the options the details get updated on the existing address fields from client page and when user will click the save button, they will get updated on Client page.

This is about the whole functionality.

Hope it may help you to understand the code.

Please advise.


Thanks again

Nitesh
Nitesh AgarwalNitesh Agarwal
Updated test class is this with minr changes I am talking about in the name of the methods

@isTest
 public class customPickListInVFDemoControllerTest
 {
    public static testmethod void testcustomPickListInVFDemoController()
    {
         
           // Create sample data.
           Client__c client = new Client__c ();
           client.Client_Family_Name__c = 'Testclientfamilyname';
           client.Given_Names__c = 'Testclientgivenname';
           client.Street_Address__c = '5 Osborne Avenue';
           client.Suburb__c = 'Springvale';
           client.Postcode__c = '3171';
           client.State__c = 'VIC';
           insert client;

ApexPages.StandardController std=new ApexPages.StandardController(client);
  CustomPicklistInVfDemoController exten=new CustomPicklistInVfDemoController(std);
  List<SelectOption> pc= exten.getPostCodeOptions();
  List<SelectOption> so= exten.getSuburbsOptions();
  List<SelectOption> ppc= exten.getPopulatePostCodeSuburbList();
  exten.save();
  exten.onChangePostCode();
  exten.onchangeDetails();

  
  
    } 
}
Dwight AltmanDwight Altman
How did you make an attachment?  I would like to show my Validation Errors as well in Apex Quick Start exercise Deployment Validation failure (https://developer.salesforce.com/forums/?id=906F0000000BKoHIAW)
Nitesh AgarwalNitesh Agarwal
Dear Dwight,

When you answer there are MS office applications like menu bar you can see, with the help of the symbol before the image sign you can attach the files.

Hope it helps.

Thanks
Nitesh
Nitesh AgarwalNitesh Agarwal
Dear All,

I am stcuk with this change set, I have managed to achieve 78% code coverage for my apex class, however, when i validate it on my produciton, it now says have 0% code coverage for a particular trigger. I have not created any trigger in my this piece of requirement. 

I am clueless as to what to do now.

I would be grateful, if anybody any help with this.

I am fine if you wish to discuss this over my personal email id.

Thanks
Nitesh
Dwight AltmanDwight Altman
Thanks Nitesh.
Take a look at my topic (https://developer.salesforce.com/forums/?id=906F0000000BKoHIAW) https://developer.salesforce.com/forums/?id=906F0000000BKoHIAW where I learned that all Unmanaged code (even unrelated to your specific Change Set) will need to pass Validation (such as that unrelated trigger).  Disappointing to learn in a Quick Start exercise.
Nitesh AgarwalNitesh Agarwal
Hi Dwight,


Thanks for it.

Still I am facing the issues. Please can anybody help. 

Thanks
Nitesh
Dwight AltmanDwight Altman
Hi Nitesh,
From my last reply, I mean that you have to fix code that is not yours (or get the original developer to fix it).  Post your latest errors and see if anyone can help.  If they are still TestClientContactSync, you need to supply the REQUIRED MISSING FIELD.  If still TestTaskSync, apparently you have to change it to use an ACTIVE USER.  Find those tests and fix them.