• Sanket 9
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 0
    Replies
Hi,
I am facing an issue where the debug logs are not getting generated for my site guest profile. What can be the issue here ?. Until last week all was going well. Our production org seems to be working fine and is generating logs for the same. It only does not work when it comes to our sandbox envoirnment. Is there something related to cookies or any other browser config that is to be changed ?

 
Hi All,
Facing an issue which has halted many processes. I have an approval button for payment which on click converts the lead to an account and corresponding Opportunity . In production everything works fine but recently our org refreshed the sandbox. 
Now none of the leads are converting. Sharing an error . Please help .

faultcode:soapenv:client: --------> Unavailable recordtype exception.
Hi All,

I have a custom object named Payment, which has look up to Lead. On Payment page, I have a button to call Apex class, which changes Lead status which in turn results in after update lead trigger that converts lead using  Database.convertLead() method.
I am having System Administrator profile, but I am getting error as ConvertLead failed. First exception on row 0; first error: UNAVAILABLE RECORDTYPE EXCEPTION, Unable to find default record type

Note: I just created new sandbox, and this function has stopped working on new sandbox. Same functionality is working on Production. My profile has default record type assigned for Account, which is common answer found for this issue. But that is already in place and issue still persists.

Lead, Opportunity do not have record types and there is no custom field vaidation exception shown in debug log.

Any help is highly appreciated.

Approval Page Error on Payment details page:
User-added image
 
//Code for class called from Payment detail page button: 

global class nmLeadWebService 
{
    //New method for Approve registration by IC
    webService static string ApproveRegistrationNew(String strLeadId) 
    {
         Lead objLead = new Lead(id=strLeadId);
         objLead.nm_LeadContacted__c = 'Yes'; 
         
         update objLead;
        
         objLead.nm_PaymentCompleted__c = true;
         
         update objLead;
       
         objLead = [select id, ConvertedAccountId, convertedOpportunityId from Lead where id =: strLeadId];
        
         //Code to transfer registration payment record to opportunity from lead
         List<nm_Payment__c> lstPayment = [select id, nm_OpportunityNew__c from nm_Payment__c where nm_Lead__c =: strLeadId and nm_PaymentStatus__c='Payment Made'];
         if(lstPayment != null && lstPayment.size() > 0)
         {
            for(nm_Payment__c objPayment : lstPayment)
            {
                       
                objPayment.nm_Lead__c = null;
                objPayment.nm_OpportunityNew__c = objLead.ConvertedOpportunityId;               
            }
            
            update lstPayment;
         }
         system.debug('Done');
         return objLead.ConvertedAccountId;
    }
 
//Code in Lead Trigger handler class
//Method to convert lead once Registration payments completed
    public void ConvertLead(list<Lead> lstLead, map<id, Lead> leadOldMap)
    {
        if(lstLead != null && lstLead.size() > 0)
        {
            set<string> strDuplicate = new set<string>();
            //Adding Email MobilePhone in set in string format 
            for(Lead objLead : lstLead)
            {
                strDuplicate.add(((String)objLead.Email + (String) objLead.MobilePhone ).toLowerCase());
                System.debug('**strDuplicate'+strDuplicate);
            }
            
            //getting accounts already in Account
            list<Account> lstAccount = [select id,(select id from Contacts limit 1), 
                                        nm_CheckDuplicate__c from Account
                                         where nm_CheckDuplicate__c in : strDuplicate];
            System.debug('**lst account'+lstAccount);
            map<string, Account> mapDupAccounts = new map<string, Account>();
            for(Account objAccount : lstAccount)
            {
                mapDupAccounts.put(objAccount.nm_CheckDuplicate__c, objAccount);
            }
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            for(Lead objLead : lstLead)
            {
                //Checking is registration payment done
                if(objLead.nm_Program__c != null && objLead.nm_EligiblityCriteria__c != null && objLead.nm_PaymentCompleted__c == true && leadOldMap.get(objLead.id).nm_PaymentCompleted__c == false)
                {
                    string strLead = ((String)objLead.Email + (String) objLead.MobilePhone ).toLowerCase();
                    if(mapDupAccounts.get(strLead) != null)
                    {
                        Database.LeadConvert lc = new Database.LeadConvert();
                        
                        lc.setLeadId(objLead.id);
                        lc.setAccountId(mapDupAccounts.get(strLead).id);
                        
                        lc.setContactId(mapDupAccounts.get(strLead).Contacts[0].id);
                        
                        
                        lc.setConvertedStatus(convertStatus.MasterLabel);
                        
                        try{
                            Database.LeadConvertResult lcr = Database.convertLead(lc);
                        }
                        catch(exception ex)
                        {
                            objLead.addError(ex.getMessage()); 
                        }
                    }
                    
                    else
                    {
                        Database.LeadConvert lc = new Database.LeadConvert();
                        
                        lc.setLeadId(objLead.id);
                        
                       // LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                        lc.setConvertedStatus(convertStatus.MasterLabel);
                        
                        try{
                            Database.LeadConvertResult lcr = Database.convertLead(lc);
                        }
                        catch(exception ex)
                        {
                            objLead.addError(ex.getMessage());
                        }
                    }                   
                }
            }
        }
    }

 
Hi All,

I have a custom object named Payment, which has look up to Lead. On Payment page, I have a button to call Apex class, which changes Lead status which in turn results in after update lead trigger that converts lead using  Database.convertLead() method.
I am having System Administrator profile, but I am getting error as ConvertLead failed. First exception on row 0; first error: UNAVAILABLE RECORDTYPE EXCEPTION, Unable to find default record type

Note: I just created new sandbox, and this function has stopped working on new sandbox. Same functionality is working on Production. My profile has default record type assigned for Account, which is common answer found for this issue. But that is already in place and issue still persists. Convert Lead option is also enabled for me.

Lead, Opportunity do not have record types and there is no custom field vaidation exception shown in debug log.

Any help is highly appreciated.

Approval Page Error on Payment details page:
User-added image
 
//Code for class called from Payment detail page button: 

global class nmLeadWebService 
{
    //New method for Approve registration by IC
    webService static string ApproveRegistrationNew(String strLeadId) 
    {
         Lead objLead = new Lead(id=strLeadId);
         objLead.nm_LeadContacted__c = 'Yes'; 
         
         update objLead;
        
         objLead.nm_PaymentCompleted__c = true;
         
         update objLead;
       
         objLead = [select id, ConvertedAccountId, convertedOpportunityId from Lead where id =: strLeadId];
        
         //Code to transfer registration payment record to opportunity from lead
         List<nm_Payment__c> lstPayment = [select id, nm_OpportunityNew__c from nm_Payment__c where nm_Lead__c =: strLeadId and nm_PaymentStatus__c='Payment Made'];
         if(lstPayment != null && lstPayment.size() > 0)
         {
            for(nm_Payment__c objPayment : lstPayment)
            {
                       
                objPayment.nm_Lead__c = null;
                objPayment.nm_OpportunityNew__c = objLead.ConvertedOpportunityId;               
            }
            
            update lstPayment;
         }
         system.debug('Done');
         return objLead.ConvertedAccountId;
    }

//Code in Lead Trigger handler class
//Method to convert lead once Registration payments completed
    public void ConvertLead(list<Lead> lstLead, map<id, Lead> leadOldMap)
    {
        if(lstLead != null && lstLead.size() > 0)
        {
            set<string> strDuplicate = new set<string>();
            //Adding Email MobilePhone in set in string format 
            for(Lead objLead : lstLead)
            {
                strDuplicate.add(((String)objLead.Email + (String) objLead.MobilePhone ).toLowerCase());
                System.debug('**strDuplicate'+strDuplicate);
            }
            
            //getting accounts already in Account
            list<Account> lstAccount = [select id,(select id from Contacts limit 1), 
                                        nm_CheckDuplicate__c from Account
                                         where nm_CheckDuplicate__c in : strDuplicate];
            System.debug('**lst account'+lstAccount);
            map<string, Account> mapDupAccounts = new map<string, Account>();
            for(Account objAccount : lstAccount)
            {
                mapDupAccounts.put(objAccount.nm_CheckDuplicate__c, objAccount);
            }
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            for(Lead objLead : lstLead)
            {
                //Checking is registration payment done
                if(objLead.nm_Program__c != null && objLead.nm_EligiblityCriteria__c != null && objLead.nm_PaymentCompleted__c == true && leadOldMap.get(objLead.id).nm_PaymentCompleted__c == false)
                {
                    string strLead = ((String)objLead.Email + (String) objLead.MobilePhone ).toLowerCase();
                    if(mapDupAccounts.get(strLead) != null)
                    {
                        Database.LeadConvert lc = new Database.LeadConvert();
                        
                        lc.setLeadId(objLead.id);
                        lc.setAccountId(mapDupAccounts.get(strLead).id);
                        
                        lc.setContactId(mapDupAccounts.get(strLead).Contacts[0].id);
                        
                        
                        lc.setConvertedStatus(convertStatus.MasterLabel);
                        
                        try{
                            Database.LeadConvertResult lcr = Database.convertLead(lc);
                        }
                        catch(exception ex)
                        {
                            objLead.addError(ex.getMessage()); 
                        }
                    }
                    
                    else
                    {
                        Database.LeadConvert lc = new Database.LeadConvert();
                        
                        lc.setLeadId(objLead.id);
                        
                       // LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                        lc.setConvertedStatus(convertStatus.MasterLabel);
                        
                        try{
                            Database.LeadConvertResult lcr = Database.convertLead(lc);
                        }
                        catch(exception ex)
                        {
                            objLead.addError(ex.getMessage());
                        }
                    }                   
                }
            }
        }
    }