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
SmartDSmartD 

Custom Lead convert process

Hello Everyone,

 

I have come across an issue which I didn't find any solution.

 

I have a apex class for custom lead convert process and is working fine if there is not activity history or the activity history having small sized content.

 

If the task content is too large it throws an exception.

 

I am sharing the debug log.

 

Please provide me any helpful ways to solve this issue.

 

26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
-------------------------

--------------------------
02:17:50.678 (678677000)|ENTERING_MANAGED_PKG|SFSSDupeCatcher
02:17:50.681 (681630000)|SOQL_EXECUTE_BEGIN|[105]|Aggregations:0|select Id, Name, SFSSDupeCatcher__Match_On_Insert_Action__c, SFSSDupeCatcher__Match_On_Update_Action__c, SFSSDupeCatcher__Create_Tasks_for_Warnings__c, SFSSDupeCatcher__Blocked_Duplicates__c, SFSSDupeCatcher__Merged_Duplicates__c, SFSSDupeCatcher__Converted_Duplicates__c, SFSSDupeCatcher__Error_Message__c, SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Deployed__c, SFSSDupeCatcher__Bypass_Security__c, SFSSDupeCatcher__Person_Account_Filter__c, OwnerID, CreatedById from Scenario__c where Deployed__c = true limit 100
02:17:50.685 (685796000)|SOQL_EXECUTE_END|[105]|Rows:0
02:17:50.690 (690121000)|DML_END|[462]
02:17:50.690 (690632000)|METHOD_ENTRY|[467]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_lead_id()
02:17:50.690 (690674000)|METHOD_EXIT|[467]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_lead_id()
02:17:50.690 (690747000)|METHOD_ENTRY|[468]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_account()
02:17:50.690 (690777000)|METHOD_EXIT|[468]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_account()
02:17:50.691 (691098000)|SOQL_EXECUTE_BEGIN|[472]|Aggregations:0|select Id, MasterLabel from LeadStatus where IsConverted = true limit 1
02:17:50.692 (692818000)|SOQL_EXECUTE_END|[472]|Rows:1
02:17:50.693 (693116000)|SYSTEM_METHOD_ENTRY|[475]|Database.convertLead(Database.LeadConvert)
02:17:50.693 (693185000)|DML_BEGIN|[475]|Op:ConvertLead|Type:LeadConvertResult|Rows:1
02:17:50.956 (956982000)|ENTERING_MANAGED_PKG|SFSSDupeCatcher
02:17:50.961 (961732000)|SOQL_EXECUTE_BEGIN|[159]|Aggregations:0|select Id, Name, SFSSDupeCatcher__Match_On_Insert_Action__c, SFSSDupeCatcher__Match_On_Update_Action__c, SFSSDupeCatcher__Create_Tasks_for_Warnings__c, SFSSDupeCatcher__Blocked_Duplicates__c, SFSSDupeCatcher__Merged_Duplicates__c, SFSSDupeCatcher__Converted_Duplicates__c, SFSSDupeCatcher__Error_Message__c, SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Deployed__c, SFSSDupeCatcher__Bypass_Security__c, SFSSDupeCatcher__Person_Account_Filter__c, OwnerID, CreatedById from Scenario__c where (Deployed__c = true and Match_On_Update_Action__c != 'Report Duplicate') limit 100
02:17:50.967 (967264000)|SOQL_EXECUTE_END|[159]|Rows:0
02:17:50.998 (998738000)|ENTERING_MANAGED_PKG|SFSSDupeCatcher
02:17:51.002 (1002036000)|SOQL_EXECUTE_BEGIN|[214]|Aggregations:0|select Id, Name, SFSSDupeCatcher__Match_On_Insert_Action__c, SFSSDupeCatcher__Match_On_Update_Action__c, SFSSDupeCatcher__Create_Tasks_for_Warnings__c, SFSSDupeCatcher__Blocked_Duplicates__c, SFSSDupeCatcher__Merged_Duplicates__c, SFSSDupeCatcher__Converted_Duplicates__c, SFSSDupeCatcher__Error_Message__c, SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Deployed__c, SFSSDupeCatcher__Bypass_Security__c, SFSSDupeCatcher__Person_Account_Filter__c, OwnerID, CreatedById from Scenario__c where Deployed__c = true limit 100
02:17:51.004 (1004907000)|SOQL_EXECUTE_END|[214]|Rows:0
02:17:51.033 (1033791000)|ENTERING_MANAGED_PKG|npe01
02:17:51.035 (1035462000)|SOQL_EXECUTE_BEGIN|[59]|Aggregations:0|select Id, npe01__One2OneContact__c from Account where Id = :tmpVar1
02:17:51.039 (1039545000)|SOQL_EXECUTE_END|[59]|Rows:1
02:17:51.041 (1041448000)|ENTERING_MANAGED_PKG|npe5
02:17:51.043 (1043201000)|ENTERING_MANAGED_PKG|SFSSDupeCatcher
02:17:51.046 (1046670000)|SOQL_EXECUTE_BEGIN|[159]|Aggregations:0|select Id, Name, SFSSDupeCatcher__Match_On_Insert_Action__c, SFSSDupeCatcher__Match_On_Update_Action__c, SFSSDupeCatcher__Create_Tasks_for_Warnings__c, SFSSDupeCatcher__Blocked_Duplicates__c, SFSSDupeCatcher__Merged_Duplicates__c, SFSSDupeCatcher__Converted_Duplicates__c, SFSSDupeCatcher__Error_Message__c, SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Deployed__c, SFSSDupeCatcher__Bypass_Security__c, SFSSDupeCatcher__Person_Account_Filter__c, OwnerID, CreatedById from Scenario__c where (Deployed__c = true and Match_On_Update_Action__c != 'Report Duplicate') limit 100
02:17:51.051 (1051171000)|SOQL_EXECUTE_END|[159]|Rows:0
02:17:51.077 (1077404000)|ENTERING_MANAGED_PKG|npe01
02:17:51.078 (1078466000)|SOQL_EXECUTE_BEGIN|[48]|Aggregations:0|select id, npe01__SystemAccountProcessor__c, npe01__Private__c, AccountId, Account.npe01__SYSTEMIsIndividual__c, Account.Name, npe01__Organization_Type__c, firstname, lastname, MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry, OtherStreet, OtherCity, OtherState, OtherPostalCode, OtherCountry, Phone, Fax from Contact where Id IN :tmpVar1
02:17:51.099 (1099584000)|SOQL_EXECUTE_END|[48]|Rows:1
02:17:51.102 (1102115000)|SOQL_EXECUTE_BEGIN|[59]|Aggregations:0|select Id, npe01__One2OneContact__c from Account where Id = :tmpVar1
02:17:51.107 (1107942000)|SOQL_EXECUTE_END|[59]|Rows:1
02:17:51.111 (1111819000)|ENTERING_MANAGED_PKG|npo02
02:17:51.114 (1114144000)|ENTERING_MANAGED_PKG|npe5
02:17:51.116 (1116547000)|ENTERING_MANAGED_PKG|SFSSDupeCatcher
02:17:51.119 (1119293000)|SOQL_EXECUTE_BEGIN|[214]|Aggregations:0|select Id, Name, SFSSDupeCatcher__Match_On_Insert_Action__c, SFSSDupeCatcher__Match_On_Update_Action__c, SFSSDupeCatcher__Create_Tasks_for_Warnings__c, SFSSDupeCatcher__Blocked_Duplicates__c, SFSSDupeCatcher__Merged_Duplicates__c, SFSSDupeCatcher__Converted_Duplicates__c, SFSSDupeCatcher__Error_Message__c, SFSSDupeCatcher__Scenario_Type__c, SFSSDupeCatcher__Deployed__c, SFSSDupeCatcher__Bypass_Security__c, SFSSDupeCatcher__Person_Account_Filter__c, OwnerID, CreatedById from Scenario__c where Deployed__c = true limit 100
02:17:51.122 (1122144000)|SOQL_EXECUTE_END|[214]|Rows:0
02:17:51.170 (1170068000)|ENTERING_MANAGED_PKG|npe01
02:17:51.248 (1248592000)|ENTERING_MANAGED_PKG|npe01
02:17:51.253 (1253409000)|ENTERING_MANAGED_PKG|npo02
02:17:51.256 (1256148000)|ENTERING_MANAGED_PKG|npo02
02:17:51.705 (1705281000)|FATAL_ERROR|System.DmlException: Update failed. First exception on row 4 with id ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it.
Call Result: data value too large: Additional To: mmm.www@yahoo.com<br>CC: <br>BCC: <br>Attachment: .......some chars.................................................. <br><br>Selling Produc (max length=255): []

(System Code)

02:17:51.705 (1705325000)|FATAL_ERROR|System.DmlException: Update failed. First exception on row 4 with id ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it.
Call Result: data value too large: Additional To: mmm.www@yahoo.com<br>CC: <br>BCC: <br>Attachment: ............................................some chars <br><br>Selling Produc (max length=255): []

(System Code)

02:17:51.706 (1706116000)|DML_END|[475]
02:17:51.706 (1706269000)|EXCEPTION_THROWN|[475]|System.DmlException: ConvertLead failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, System.DmlException: Update failed. First exception on row 4 with id ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it.
Call Result: data value too large: Additional To: mmm.www@yahoo.com<br>CC: <br>BCC: <br>Attachment: ...........................some chars.....................<br><br> <br><br>Selling Produc (max length=255): []

(System Code)
: []
02:17:51.710 (1710751000)|SYSTEM_METHOD_EXIT|[475]|Database.convertLead(Database.LeadConvert)
02:17:51.710 (1710836000)|SYSTEM_METHOD_ENTRY|[509]|System.DmlException.getMessage()
02:17:51.710 (1710912000)|SYSTEM_METHOD_EXIT|[509]|System.DmlException.getMessage()
02:17:51.710 (1710962000)|SYSTEM_METHOD_ENTRY|[509]|System.debug(ANY)
02:17:51.710 (1710984000)|USER_DEBUG|[509]|DEBUG|------EXCEPTION OCCURRED-----ConvertLead failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, System.DmlException: Update failed. First exception on row 4 with id ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it.
Call Result: data value too large: Additional To: mmmm.www@yahoo.com<br>CC: <br>BCC: <br>Attachment: .......................some chars...............<br><br> <br><br>Selling Produc (max length=255): []

(System Code)
: []
02:17:51.711 (1711028000)|SYSTEM_METHOD_EXIT|[509]|System.debug(ANY)
02:17:51.711 (1711061000)|METHOD_EXIT|[250]|01pa00000017d3f|CustomLeadConvertProcess.createContactExsitingAccount()
02:17:51.711 (1711088000)|METHOD_ENTRY|[257]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_option()
02:17:51.711 (1711136000)|METHOD_EXIT|[257]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_option()
02:17:51.711 (1711165000)|METHOD_ENTRY|[263]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_option()
02:17:51.711 (1711211000)|METHOD_EXIT|[263]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_option()
02:17:51.711 (1711240000)|METHOD_ENTRY|[269]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_option()
02:17:51.711 (1711286000)|METHOD_EXIT|[269]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_option()
02:17:51.711 (1711311000)|METHOD_ENTRY|[269]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_account()
02:17:51.711 (1711331000)|METHOD_EXIT|[269]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_account()
02:17:51.711 (1711350000)|METHOD_ENTRY|[269]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_account()
02:17:51.711 (1711369000)|METHOD_EXIT|[269]|01pa00000017d3f|CustomLeadConvertProcess.__sfdc_selected_account()
02:17:51.711 (1711534000)|SYSTEM_METHOD_ENTRY|[271]|ApexPages.addMessage(ApexPages.Message)
02:17:51.711 (1711605000)|VF_PAGE_MESSAGE|An unknown error occured.Please contact administrator.
02:17:51.711 (1711631000)|SYSTEM_METHOD_EXIT|[271]|ApexPages.addMessage(ApexPages.Message)
02:17:51.853 (1853161000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess invoke(doConvertProcess)
02:17:51.854 (1854783000)|VF_APEX_CALL|convert_process|{!doConvertProcess}|PageReference: none
02:17:51.866 (1866672000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(contact_count)
02:17:51.866 (1866693000)|SYSTEM_MODE_ENTER|true
02:17:51.866 (1866705000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|contact_count
02:17:51.866 (1866718000)|CODE_UNIT_FINISHED|contact_count
02:17:51.866 (1866727000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(contact_count)
02:17:51.866 (1866769000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(show_contact_list)
02:17:51.866 (1866779000)|SYSTEM_MODE_ENTER|true
02:17:51.866 (1866789000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|show_contact_list
02:17:51.866 (1866800000)|CODE_UNIT_FINISHED|show_contact_list
02:17:51.866 (1866808000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(show_contact_list)
02:17:51.866 (1866912000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(account_count)
02:17:51.866 (1866925000)|SYSTEM_MODE_ENTER|true
02:17:51.866 (1866935000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|account_count
02:17:51.866 (1866948000)|CODE_UNIT_FINISHED|account_count
02:17:51.866 (1866956000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(account_count)
02:17:51.866 (1866993000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(show_account_list)
02:17:51.867 (1867003000)|SYSTEM_MODE_ENTER|true
02:17:51.867 (1867014000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|show_account_list
02:17:51.867 (1867025000)|CODE_UNIT_FINISHED|show_account_list
02:17:51.867 (1867033000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(show_account_list)
02:17:51.867 (1867186000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(account_name)
02:17:51.867 (1867199000)|SYSTEM_MODE_ENTER|true
02:17:51.867 (1867210000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|account_name
02:17:51.867 (1867222000)|CODE_UNIT_FINISHED|account_name
02:17:51.867 (1867230000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(account_name)
02:17:51.946 (1946689000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(option_list)
02:17:51.946 (1946711000)|SYSTEM_MODE_ENTER|true
02:17:51.946 (1946723000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|option_list
02:17:51.946 (1946737000)|CODE_UNIT_FINISHED|option_list
02:17:51.946 (1946746000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(option_list)
02:17:51.947 (1947432000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(selected_option)
02:17:51.947 (1947450000)|SYSTEM_MODE_ENTER|true
02:17:51.947 (1947461000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|selected_option
02:17:51.947 (1947476000)|CODE_UNIT_FINISHED|selected_option
02:17:51.947 (1947484000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(selected_option)
02:17:51.948 (1948131000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(account_list)
02:17:51.948 (1948151000)|SYSTEM_MODE_ENTER|true
02:17:51.948 (1948164000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|account_list
02:17:51.948 (1948177000)|CODE_UNIT_FINISHED|account_list
02:17:51.948 (1948186000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(account_list)
02:17:51.949 (1949011000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(selected_account)
02:17:51.949 (1949028000)|SYSTEM_MODE_ENTER|true
02:17:51.949 (1949040000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|selected_account
02:17:51.949 (1949053000)|CODE_UNIT_FINISHED|selected_account
02:17:51.949 (1949062000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(selected_account)
02:17:51.949 (1949646000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(account_city)
02:17:51.949 (1949660000)|SYSTEM_MODE_ENTER|true
02:17:51.949 (1949672000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|account_city
02:17:51.949 (1949684000)|CODE_UNIT_FINISHED|account_city
02:17:51.949 (1949692000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(account_city)
02:17:51.949 (1949765000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|CustomLeadConvertProcess get(account_state)
02:17:51.949 (1949777000)|SYSTEM_MODE_ENTER|true
02:17:51.949 (1949787000)|CODE_UNIT_STARTED|[EXTERNAL]|01pa00000017d3f|account_state
02:17:51.949 (1949799000)|CODE_UNIT_FINISHED|account_state
02:17:51.949 (1949808000)|CODE_UNIT_FINISHED|CustomLeadConvertProcess get(account_state)
02:17:51.952 (1952531000)|VF_SERIALIZE_VIEWSTATE_BEGIN|066a0000000jxEr
02:17:51.957 (1957992000)|VF_SERIALIZE_VIEWSTATE_END
02:17:52.874 (1962698000)|CUMULATIVE_LIMIT_USAGE
02:17:52.874|LIMIT_USAGE_FOR_NS|(default)|

 

---------------------------------My code is as below.....................

                    //Custom Lead Conversion.
                    Database.LeadConvert lc = new database.LeadConvert();
                    lc.setLeadId(lead_id);
                    lc.setAccountId( selected_account );
                    lc.setContactId( contact_obj.Id );
                    //lc.doNotCreateOpportunity = true;
                    
                    LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                    lc.setConvertedStatus(convertStatus.MasterLabel);
                    
                    Database.LeadConvertResult lcr = Database.convertLead(lc);
                    System.debug('-----------'+lcr.isSuccess()+'---------------');