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
Amila NiroshanAmila Niroshan 

Mass Convert Leads Error - SObject row was retrieved via SOQL without querying the requested field: Lead.Fax

:
Hi
I have come across the following error when I tried to " Mass Convert Leads".
SObject row was retrieved via SOQL without querying the requested field: Lead.Fax
Error is in expression '{!convertLeads}' in component in page massleadconverter: Class.MassLeadConverterController.convertLeads: line 96, column 1
Package :  Mass Lead Converter
Publisher - Force.com Labs - Mass Lead Converter
Version - 1.10
How can I change the apex code to aovid this error? Or is there another way to handle this issue? 
Best Answer chosen by Amila Niroshan
Tejpal KumawatTejpal Kumawat
Hello Amila,

Go to selectedItems item query you need to add Fax field. For more assistace you can skype also.

Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!

All Answers

Tejpal KumawatTejpal Kumawat
Hello Amila,

You need to add 'Fax' in query which is used in convertLeads method of MassLeadConverterController.

If this answers your question mark Best Answer it as solution and then hit Like!
Jyosi jyosiJyosi jyosi
Hello Amila,

Can you please add the Fax in the Query .

Thanks

Regards,
Jyo
Amila NiroshanAmila Niroshan
Thanks Guys!  Appreciate your response. I need your support to clarify two more doubts.

1.
Could you please tell me how to edit this unmanaged package?  I'm totally new to apex develpment. I tried to copy the code & create a new class in sandbox. It doesn't work that way. 


2.
This is the sample code which generate the error.

 public PageReference convertLeads()
  {
    Database.LeadConvert ltc = new database.LeadConvert();
    LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus where IsConverted=true limit 1];
    List<Database.LeadConvert> leadsToConvert = new List<Database.LeadConvert>();
    
    if (accOption == 'Create new account')
    {
      //gather information from first lead and create new account
      Account acc1 = new Account();
      acc1.Name = accountName;
      acc1.Phone = selectedItems[0].Phone;
      acc1.BillingCity = selectedItems[0].City;
      acc1.BillingCountry = selectedItems[0].Country;
      acc1.BillingPostalCode = selectedItems[0].PostalCode;
      acc1.BillingState = selectedItems[0].State;
      acc1.BillingStreet = selectedItems[0].Street;
      acc1.Fax = selectedItems[0].Fax;
      acc1.Rating = selectedItems[0].Rating;
      acc1.NumberOfEmployees = selectedItems[0].NumberOfEmployees;
      acc1.Website = selectedItems[0].Website;


This SOQL gets data from LeadStatus table. However it doesn't have fax number field. There is another table named Lead. Fax no is a field in that table.  Therefore the table need to be changed in this SOQL?
 
Tejpal KumawatTejpal Kumawat
Hello Amila,

Go to selectedItems item query you need to add Fax field. For more assistace you can skype also.

Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!
This was selected as the best answer