You need to sign in to do that
Don't have an account?
Joshua Anderson 17
Trigger to update Opportunity with Lead in lookup after convert
I am looking to update a lookup field on the opportunity after a lead has been converted. Not sure if this is possible so I was first wondering if we could even do this. I currently have mapped the fields with a formula so that the lead ID shows on the opportunity but after the lead is converted the lookup will not allow me to select a converted lead.
Does anyone have any suggestions to try and get me on the right track?
Does anyone have any suggestions to try and get me on the right track?
It looks like there is an attempt to save an opportunity id to a lead lookup field that is expecting a record id for the lead.
Lead ids start with 00Q
Opportunities ids start with 006
In your record update action, set the Opportunity.Lead__c = Lead.Id
As a side note, it looks like you have a number of workflow rules in your org. You may want to consider refactoring all of the lead workflow rules into one process builder process and do the same thing with the opportunity process builders.
All Answers
Create a new Process Builder on the Lead Object when a new record is created or updated.
Here is the outline for this solution
Criteria step
- Lead.IsConverted = true AND hasChanged(Lead.IsConverted) AND Lead.OpportunityId is not Null
Immediate Action
- Update Record - the opportunity record related to the lead
- Update Opportunity.Lead__c = Lead.OpportunityId
Note, When a lead is converted, the resulting opportunity, account, and contact is related to the lead. That is why this should work for you.
I wanted to make sure that I am understanding everything correctly. I have attached screenshots to show what I did just to confrim. I am also getting an error when I try and do ISCHANGED.
Did I do everything correct besides the is changed?
Please, Try this as your criteria: NOT(IsBlank([Lead].ConvertedOpportunityId)) && [Lead].IsConverted && ISCHANGED([Lead].IsConverted ). I was able to save this without error.
In regards to update records step, it is correct.
I was able to save via process builder. When I selected to convert the lead to test to see if the opportunity would populate the lead id information it is still not doing so. Any idea what might be happening with this?
My apologies. On the Update record Immediate action, choose the Converted Opportunity reocrd instead of Opportunties__r
I altered the process builder to reflect converted opportunity but when I try and convert I am now getting an error.
"Error: System.DmlException: Update failed. First exception on row 0 with id 00Q5C000000ya6yUAA; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3015C0000008Xwx. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: [] Class.leadconvert.BulkLeadConvert.updateLead: line 1440, column 1 Class.leadconvert.BulkLeadConvert.convertLead: line 157, column 1"
Do you have any existing triggers, workflow rules or validation rules on the lead object? It looks like that error may occur when there is an attempt to update a converted lead.
Can you please monitor your user and generate a debug log and paste to the forum? Please see this for more details https://help.salesforce.com/articleView?id=code_add_users_debug_log.htm&language=en_US&type=0
10:57:19.0 (61087)|USER_INFO|[EXTERNAL]|0050P000006jNqq|joshua.anderson@televerde.com.joshdev1|Mountain Standard Time|GMT-07:00
10:57:19.0 (175595)|VARIABLE_SCOPE_BEGIN|[3]|BulkLeadConvert.EMPTY_KEY|String|false|true
10:57:19.0 (384997)|HEAP_ALLOCATE|[72]|Bytes:3
10:57:19.0 (423147)|HEAP_ALLOCATE|[77]|Bytes:152
10:57:19.0 (437987)|HEAP_ALLOCATE|[342]|Bytes:408
10:57:19.0 (451900)|HEAP_ALLOCATE|[355]|Bytes:408
10:57:19.0 (463868)|HEAP_ALLOCATE|[467]|Bytes:48
10:57:19.105 (105459943)|ENTERING_MANAGED_PKG|FormPos
10:57:19.105 (106876841)|ENTERING_MANAGED_PKG|FormPos
10:57:19.108 (108652671)|CUMULATIVE_LIMIT_USAGE
10:57:19.108 (108652671)|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Maximum CPU time: 0 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
10:57:19.108 (108652671)|CUMULATIVE_LIMIT_USAGE_END
10:57:19.186 (186888418)|ENTERING_MANAGED_PKG|FormPos
10:57:19.186 (186979350)|CUMULATIVE_LIMIT_USAGE
10:57:19.186 (186979350)|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Maximum CPU time: 0 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
10:57:19.186 (186979350)|CUMULATIVE_LIMIT_USAGE_END
10:57:19.0 (255359029)|DML_END|[326]
10:57:19.312 (312451772)|CODE_UNIT_STARTED|[EXTERNAL]|01qU00000004fxU|OpportunityTrigger on Opportunity trigger event AfterInsert for [0065C000002Q95U]
10:57:19.312 (312489152)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:57:19.312 (314788602)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:57:19.312 (314798037)|VARIABLE_SCOPE_BEGIN|[1]|this|OpportunityTrigger|true|false
10:57:19.312 (314850500)|VARIABLE_ASSIGNMENT|[1]|this|{}|0x6853cb2c
10:57:19.312 (314889249)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:57:19.312 (314893906)|VARIABLE_SCOPE_BEGIN|[1]|this|OpportunityTrigger|true|false
10:57:19.312 (314903237)|VARIABLE_ASSIGNMENT|[1]|this|{}|0x6853cb2c
10:57:19.312 (314907041)|STATEMENT_EXECUTE|[1]
10:57:19.312 (314908664)|STATEMENT_EXECUTE|[2]
10:57:19.312 (314916848)|HEAP_ALLOCATE|[2]|Bytes:5
10:57:19.312 (314922181)|HEAP_ALLOCATE|[2]|Bytes:66
10:57:19.312 (314935168)|METHOD_ENTRY|[11]|01pU00000008K9w|OpportunityTrigger.OpportunityTrigger()
10:57:19.312 (314937582)|STATEMENT_EXECUTE|[11]
10:57:19.312 (314940165)|STATEMENT_EXECUTE|[11]
10:57:19.312 (315329143)|SYSTEM_MODE_ENTER|false
10:57:19.312 (315337686)|HEAP_ALLOCATE|[2]|Bytes:5
10:57:19.312 (315344783)|SYSTEM_MODE_EXIT|false
10:57:19.312 (315353356)|METHOD_EXIT|[11]|OpportunityTrigger
10:57:19.312 (315365322)|HEAP_ALLOCATE|[2]|Bytes:4
10:57:19.312 (315375900)|CONSTRUCTOR_ENTRY|[2]|01pU00000008K9w|<init>()
10:57:19.312 (315398138)|VARIABLE_SCOPE_BEGIN|[11]|this|OpportunityTrigger|true|false
10:57:19.312 (315412506)|VARIABLE_ASSIGNMENT|[11]|this|{}|0x459ccec4
10:57:19.312 (315418537)|SYSTEM_MODE_ENTER|false
10:57:19.312 (315422786)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
10:57:19.312 (315442269)|SYSTEM_MODE_EXIT|false
10:57:19.312 (315444892)|STATEMENT_EXECUTE|[11]
10:57:19.312 (315447765)|SYSTEM_MODE_ENTER|false
10:57:19.312 (315449921)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
10:57:19.312 (315453924)|SYSTEM_MODE_EXIT|false
10:57:19.312 (315458783)|CONSTRUCTOR_EXIT|[2]|01pU00000008K9w|<init>()
10:57:19.312 (315475492)|VARIABLE_ASSIGNMENT|[2]|this.ot|0x459ccec4|0x6853cb2c
10:57:19.312 (315482114)|STATEMENT_EXECUTE|[3]
10:57:19.312 (315483295)|STATEMENT_EXECUTE|[4]
10:57:19.312 (315522477)|METHOD_ENTRY|[4]|01pU00000008K9w|OpportunityTrigger.updateAccountSalesSummary(List<Opportunity>)
10:57:19.312 (315541186)|VARIABLE_SCOPE_BEGIN|[12]|this|OpportunityTrigger|true|false
10:57:19.312 (315551163)|VARIABLE_ASSIGNMENT|[12]|this|{}|0x459ccec4
10:57:19.312 (315553708)|VARIABLE_SCOPE_BEGIN|[12]|Opps|List<Opportunity>|true|false
10:57:19.312 (329606330)|VARIABLE_ASSIGNMENT|[12]|Opps|{"s":1,"v":[{"LastModifiedDate":"2017-01-05T17:57:19.000Z","Sales_Order__c":false,"Data_Intelligence_To (6 more) ...":0.00,"AccountId":"0015C000002ZR9XQAW","HasOpportunityLineIt (2 more) ...":false,"Billing_Information_ (12 more) ...":false,"No_Origninal_Account (6 more) ...":false,"ForecastCategory":"Omitted","Converted_From_Lead_ (2 more) ...":false,"Close_Date_Missing__ (1 more) ...":false,"CloseDate":"2017-03-31T00:00:00.000Z","mh_Associated_Blue_S (7 more) ...":false,"Name":"42 Riot- tester 19","PLM_Review__c":false,"Teleservices_Total__ (1 more) ...":0.00,"CreatedById":"0050P000006jNqqQAE","Stage_Validation_SOW (12 more) ...":"Not SOW Received","Marketing_Technology (9 more) ...":0.00,"CSM_Assigned__c":false,"Lead_Created_DateTim (4 more) ...":"2017-01-04T22:27:46.000Z","Internal_Approval_Da (10 more) ...":"2017-01-05T00:00:00.000Z","SmartForms__c":false,"Data_Total__c":0.00,"IsDeleted":false,"Commit_Probability__ (1 more) ...":"Low","Billing_Address__c":"3710 W Mission Lane_ (39 more) ...","Open_Won_Lost__c":"Open","Contact_Missing__c":false,"Setup_Management_Tot (5 more) ...":0.00,"Digital_Total__c":0.00,"Inbound_Support_Tota (4 more) ...":0.00,"CreatedDate":"2017-01-05T17:57:19.000Z","mh_Managers_Notes_Ex (6 more) ...":false,"Id":"0065C000002Q95UQAS","Data_Quality_Score__ (1 more) ...":40,"ForecastCategoryName":"Omitted","Dialogue_Total__c":0.00,"Research_Total__c":0.00,"Dialogue_Total_No_Ca (9 more) ...":0.00,"IsClosed":false,"Opportunity_Amount__ (1 more) ...":0.00,"Clients_Validation__ (1 more) ...":false,"Data_Quality_Descrip (7 more) ...":"Missing: Type, Lead (18 more) ...","OwnerId":"0050P000006jNqqQAE","Lead_Create_Date__c":"2017-01-04T22:27:46.000Z","IsWon":false,"RecordTypeId":"012U00000000GAPIA2","StageName":"Long Range Forecast","Engagement_Planning_ (8 more) ...":0.00,"Probability":0,"Stage_Validation_Clo (10 more) ...":"Not Closed Won","mh_Additional_Notes_ (8 more) ...":false,"Stage_Missing__c":false,"Analytics_Total__c":0.00,"Reporting_Total__c":0.00,"SystemModstamp":"2017-01-05T17:57:19.000Z","Associated_Budget_Al (6 more) ...":"_IM1_/servlet/servle (117 more) ...","Viewpath__Viewpath_P (17 more) ...":"_HL_ENCODED_/_HL_ _H (11 more) ...","No_Owner_Match__c":false,"Marketing_Total__c":0.00,"IsPrivate":false,"LastModifiedById":"0050P000006jNqqQAE"}]}|0x132f8e51
10:57:19.312 (329627115)|SYSTEM_MODE_ENTER|false
10:57:19.312 (329634206)|HEAP_ALLOCATE|[17]|Bytes:5
10:57:19.312 (329638798)|STATEMENT_EXECUTE|[12]
10:57:19.312 (329640430)|STATEMENT_EXECUTE|[17]
10:57:19.312 (329650116)|HEAP_ALLOCATE|[17]|Bytes:4
10:57:19.312 (329708770)|VARIABLE_SCOPE_BEGIN|[17]|planIds|List<Id>|true|false
10:57:19.312 (329736776)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:57:19.312 (329748635)|VARIABLE_ASSIGNMENT|[17]|planIds|{"s":1,"v":[]}|0x5a5c3c9f
10:57:19.312 (329888551)|HEAP_ALLOCATE|[18]|Bytes:5
10:57:19.312 (329907986)|VARIABLE_SCOPE_BEGIN|[18]|o|Opportunity|true|false
10:57:19.312 (333225555)|VARIABLE_ASSIGNMENT|[18]|o|{"LastModifiedDate":"2017-01-05T17:57:19.000Z","Sales_Order__c":false,"Data_Intelligence_To (6 more) ...":0.00,"AccountId":"0015C000002ZR9XQAW","HasOpportunityLineIt (2 more) ...":false,"Billing_Information_ (12 more) ...":false,"No_Origninal_Account (6 more) ...":false,"ForecastCategory":"Omitted","Converted_From_Lead_ (2 more) ...":false,"Close_Date_Missing__ (1 more) ...":false,"CloseDate":"2017-03-31T00:00:00.000Z","mh_Associated_Blue_S (7 more) ...":false,"Name":"42 Riot- tester 19","PLM_Review__c":false,"Teleservices_Total__ (1 more) ...":0.00,"CreatedById":"0050P000006jNqqQAE","Stage_Validation_SOW (12 more) ...":"Not SOW Received","Marketing_Technology (9 more) ...":0.00,"CSM_Assigned__c":false,"Lead_Created_DateTim (4 more) ...":"2017-01-04T22:27:46.000Z","Internal_Approval_Da (10 more) ...":"2017-01-05T00:00:00.000Z","SmartForms__c":false,"Data_Total__c":0.00,"IsDeleted":false,"Commit_Probability__ (1 more) ...":"Low","Billing_Address__c":"3710 W Mission Lane_ (39 more) ...","Open_Won_Lost__c":"Open","Contact_Missing__c":false,"Setup_Management_Tot (5 more) ...":0.00,"Digital_Total__c":0.00,"Inbound_Support_Tota (4 more) ...":0.00,"CreatedDate":"2017-01-05T17:57:19.000Z","mh_Managers_Notes_Ex (6 more) ...":false,"Id":"0065C000002Q95UQAS","Data_Quality_Score__ (1 more) ...":40,"ForecastCategoryName":"Omitted","Dialogue_Total__c":0.00,"Research_Total__c":0.00,"Dialogue_Total_No_Ca (9 more) ...":0.00,"IsClosed":false,"Opportunity_Amount__ (1 more) ...":0.00,"Clients_Validation__ (1 more) ...":false,"Data_Quality_Descrip (7 more) ...":"Missing: Type, Lead (18 more) ...","OwnerId":"0050P000006jNqqQAE","Lead_Create_Date__c":"2017-01-04T22:27:46.000Z","IsWon":false,"RecordTypeId":"012U00000000GAPIA2","StageName":"Long Range Forecast","Engagement_Planning_ (8 more) ...":0.00,"Probability":0,"Stage_Validation_Clo (10 more) ...":"Not Closed Won","mh_Additional_Notes_ (8 more) ...":false,"Stage_Missing__c":false,"Analytics_Total__c":0.00,"Reporting_Total__c":0.00,"SystemModstamp":"2017-01-05T17:57:19.000Z","Associated_Budget_Al (6 more) ...":"_IM1_/servlet/servle (117 more) ...","Viewpath__Viewpath_P (17 more) ...":"_HL_ENCODED_/_HL_ _H (11 more) ...","No_Owner_Match__c":false,"Marketing_Total__c":0.00,"IsPrivate":false,"LastModifiedById":"0050P000006jNqqQAE"}|0x4c197f4a
10:57:19.312 (333239173)|STATEMENT_EXECUTE|[18]
10:57:19.312 (333241024)|STATEMENT_EXECUTE|[19]
10:57:19.312 (333288179)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:57:19.312 (333305007)|HEAP_ALLOCATE|[18]|Bytes:5
10:57:19.312 (333318365)|VARIABLE_ASSIGNMENT|[18]|o|null|
10:57:19.312 (333321432)|STATEMENT_EXECUTE|[23]
10:57:19.312 (333329285)|HEAP_ALLOCATE|[23]|Bytes:4
10:57:19.312 (333339024)|VARIABLE_SCOPE_BEGIN|[23]|actualSales|Map<Id,Decimal>|true|false
10:57:19.312 (333353486)|VARIABLE_ASSIGNMENT|[23]|actualSales|{"s":1,"v":{}}|0x602d6666
10:57:19.312 (333355573)|STATEMENT_EXECUTE|[24]
10:57:19.312 (333359208)|HEAP_ALLOCATE|[24]|Bytes:194
10:57:19.312 (333363699)|HEAP_ALLOCATE|[24]|Bytes:4
10:57:19.312 (333722796)|SOQL_EXECUTE_BEGIN|[24]|Aggregations:0|SELECT Associated_Account_Plan__c, SUM(Opportunity_Amount__c) Amt FROM Opportunity WHERE (Associated_Account_Plan__c IN :tmpVar1 AND StageName = 'Closed Won') GROUP BY Associated_Account_Plan__c
10:57:19.312 (359263424)|SOQL_EXECUTE_END|[24]|Rows:0
10:57:19.312 (359284372)|HEAP_ALLOCATE|[24]|Bytes:4
10:57:19.312 (359292687)|HEAP_ALLOCATE|[24]|Bytes:0
10:57:19.312 (359352746)|HEAP_ALLOCATE|[24]|Bytes:4
10:57:19.312 (359363319)|VARIABLE_SCOPE_BEGIN|[24]|planActualSales|List<AggregateResult>|true|false
10:57:19.312 (359377837)|VARIABLE_ASSIGNMENT|[24]|planActualSales|{"s":1,"v":[]}|0x63d282ca
10:57:19.312 (359500499)|HEAP_ALLOCATE|[26]|Bytes:5
10:57:19.312 (359523941)|VARIABLE_ASSIGNMENT|[26]|pas|null|
10:57:19.312 (359527256)|STATEMENT_EXECUTE|[26]
10:57:19.312 (359528994)|STATEMENT_EXECUTE|[33]
10:57:19.312 (359533193)|HEAP_ALLOCATE|[33]|Bytes:4
10:57:19.312 (359539332)|VARIABLE_SCOPE_BEGIN|[33]|pendingSales|Map<Id,Decimal>|true|false
10:57:19.312 (359551254)|VARIABLE_ASSIGNMENT|[33]|pendingSales|{"s":1,"v":{}}|0x11930ca0
10:57:19.312 (359553548)|STATEMENT_EXECUTE|[34]
10:57:19.312 (359556849)|HEAP_ALLOCATE|[34]|Bytes:226
10:57:19.312 (359563562)|HEAP_ALLOCATE|[34]|Bytes:4
10:57:19.312 (359820440)|SOQL_EXECUTE_BEGIN|[34]|Aggregations:0|SELECT Associated_Account_Plan__c, SUM(Opportunity_Amount__c) Amt FROM Opportunity WHERE (Associated_Account_Plan__c IN :tmpVar1 AND StageName != 'Closed Won' AND StageName != 'Closed Lost') GROUP BY Associated_Account_Plan__c
10:57:19.312 (361935536)|SOQL_EXECUTE_END|[34]|Rows:1
10:57:19.312 (361949506)|HEAP_ALLOCATE|[34]|Bytes:8
10:57:19.312 (361962586)|HEAP_ALLOCATE|[34]|Bytes:46
10:57:19.312 (361975250)|HEAP_ALLOCATE|[34]|Bytes:8
10:57:19.312 (361983114)|VARIABLE_SCOPE_BEGIN|[34]|planPendingSales|List<AggregateResult>|true|false
10:57:19.312 (362005671)|VARIABLE_ASSIGNMENT|[34]|planPendingSales|{"s":1,"v":[{"s":2,"v":{"Amt":0.0}}]}|0x1722ff40
10:57:19.312 (362041410)|HEAP_ALLOCATE|[37]|Bytes:5
10:57:19.312 (362067298)|HEAP_ALLOCATE|[37]|Bytes:12
10:57:19.312 (362074489)|VARIABLE_SCOPE_BEGIN|[37]|pps|AggregateResult|true|false
10:57:19.312 (362086189)|VARIABLE_ASSIGNMENT|[37]|pps|{"s":1,"v":{"Amt":0.0}}|0x61007f3c
10:57:19.312 (362089275)|STATEMENT_EXECUTE|[37]
10:57:19.312 (362090704)|STATEMENT_EXECUTE|[38]
10:57:19.312 (362094445)|HEAP_ALLOCATE|[38]|Bytes:7
10:57:19.312 (362126977)|USER_DEBUG|[38]|DEBUG|Pending
10:57:19.312 (362132303)|STATEMENT_EXECUTE|[39]
10:57:19.312 (362134976)|HEAP_ALLOCATE|[39]|Bytes:4
10:57:19.312 (362137438)|HEAP_ALLOCATE|[39]|Bytes:26
10:57:19.312 (362206439)|HEAP_ALLOCATE|[39]|Bytes:6
10:57:19.312 (362209662)|HEAP_ALLOCATE|[39]|Bytes:3
10:57:19.312 (362227139)|HEAP_ALLOCATE|[39]|Bytes:28
10:57:19.312 (362240143)|HEAP_ALLOCATE|[39]|Bytes:3
10:57:19.312 (362251979)|HEAP_ALLOCATE|[39]|Bytes:17
10:57:19.312 (362259771)|USER_DEBUG|[39]|DEBUG|ID: null-Amt: 0.0
10:57:19.312 (362263518)|STATEMENT_EXECUTE|[40]
10:57:19.312 (362297602)|HEAP_ALLOCATE|[40]|Bytes:28
10:57:19.312 (362314137)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:-4
10:57:19.312 (362325396)|HEAP_ALLOCATE|[37]|Bytes:5
10:57:19.312 (362335824)|VARIABLE_ASSIGNMENT|[37]|pps|null|
10:57:19.312 (362338586)|STATEMENT_EXECUTE|[44]
10:57:19.312 (362373301)|HEAP_ALLOCATE|[44]|Bytes:4
10:57:19.312 (362409632)|VARIABLE_SCOPE_BEGIN|[44]|updateAccountPlan|List<Account_Plan__c>|true|false
10:57:19.312 (362415305)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:57:19.312 (362424308)|VARIABLE_ASSIGNMENT|[44]|updateAccountPlan|{"s":1,"v":[]}|0x7edf8a2
10:57:19.312 (362428425)|HEAP_ALLOCATE|[45]|Bytes:86
10:57:19.312 (362432752)|HEAP_ALLOCATE|[45]|Bytes:4
10:57:19.312 (362683819)|SOQL_EXECUTE_BEGIN|[45]|Aggregations:0|SELECT Id, Pending_Sales__c, Actual_Sales__c FROM Account_Plan__c
10:57:19.312 (363563708)|SOQL_EXECUTE_END|[45]|Rows:0
10:57:19.312 (363759625)|HEAP_ALLOCATE|[45]|Bytes:49
10:57:19.312 (363766460)|HEAP_ALLOCATE|[45]|Bytes:8
10:57:19.312 (363774003)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
10:57:19.312 (363776554)|STATEMENT_EXECUTE|[7]
10:57:19.312 (363783950)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
10:57:19.312 (363789502)|HEAP_ALLOCATE|[45]|Bytes:28
10:57:19.312 (363802756)|HEAP_ALLOCATE|[45]|Bytes:8
10:57:19.312 (363805042)|HEAP_ALLOCATE|[45]|Bytes:8
10:57:19.312 (363808661)|VARIABLE_SCOPE_BEGIN|[15]|this|Database.QueryLocatorIterator|true|false
10:57:19.312 (363830230)|VARIABLE_ASSIGNMENT|[15]|this|{}|0x6e095e64
10:57:19.312 (363832709)|VARIABLE_SCOPE_BEGIN|[15]|values|List<SObject>|true|false
10:57:19.312 (363836022)|VARIABLE_ASSIGNMENT|[15]|values|null|
10:57:19.312 (363837856)|VARIABLE_SCOPE_BEGIN|[15]|ql|Database.QueryLocator|true|false
10:57:19.312 (363851130)|VARIABLE_ASSIGNMENT|[15]|ql|{"query":"SELECT Id, Pending_S (66 more) ..."}|0x10c6260c
10:57:19.312 (363853291)|VARIABLE_SCOPE_BEGIN|[15]|totalNumRecords|Integer|false|false
10:57:19.312 (363856671)|VARIABLE_ASSIGNMENT|[15]|totalNumRecords|0
10:57:19.312 (363858527)|VARIABLE_SCOPE_BEGIN|[15]|queryMoreSize|Integer|false|false
10:57:19.312 (363861000)|VARIABLE_ASSIGNMENT|[15]|queryMoreSize|49990
10:57:19.312 (363905556)|HEAP_ALLOCATE|[45]|Bytes:28
10:57:19.312 (363920095)|METHOD_ENTRY|[45]||Database.QueryLocatorIterator.hasNext()
10:57:19.312 (363935641)|METHOD_EXIT|[45]||Database.QueryLocatorIterator.hasNext()
10:57:19.312 (363945176)|VARIABLE_ASSIGNMENT|[45]|ap|null|
10:57:19.312 (363947745)|STATEMENT_EXECUTE|[45]
10:57:19.312 (363960498)|STATEMENT_EXECUTE|[64]
10:57:19.312 (364012012)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:57:19.312 (364020478)|SYSTEM_MODE_EXIT|false
10:57:19.312 (364026655)|METHOD_EXIT|[4]|01pU00000008K9w|OpportunityTrigger.updateAccountSalesSummary(List<Opportunity>)
10:57:19.312 (364039745)|STATEMENT_EXECUTE|[10]
10:57:19.312 (364041060)|STATEMENT_EXECUTE|[11]
10:57:19.312 (364100130)|METHOD_ENTRY|[11]|01pU00000008K9w|OpportunityTrigger.updateStageName(Map<Id,Opportunity>, Map<Id,Opportunity>, Boolean, Boolean)
10:57:19.312 (364119824)|VARIABLE_SCOPE_BEGIN|[67]|this|OpportunityTrigger|true|false
10:57:19.312 (364131853)|VARIABLE_ASSIGNMENT|[67]|this|{}|0x459ccec4
10:57:19.312 (364134730)|VARIABLE_SCOPE_BEGIN|[67]|oldOpps|Map<Id,Opportunity>|true|false
10:57:19.312 (364138119)|VARIABLE_ASSIGNMENT|[67]|oldOpps|null|
10:57:19.312 (364140063)|VARIABLE_SCOPE_BEGIN|[67]|newOpps|Map<Id,Opportunity>|true|false
10:57:19.312 (367450584)|VARIABLE_ASSIGNMENT|[67]|newOpps|{"s":1,"v":{"0065C000002Q95UQAS":{"LastModifiedDate":"2017-01-05T17:57:19.000Z","Sales_Order__c":false,"Data_Intelligence_To (6 more) ...":0.00,"AccountId":"0015C000002ZR9XQAW","HasOpportunityLineIt (2 more) ...":false,"Billing_Information_ (12 more) ...":false,"No_Origninal_Account (6 more) ...":false,"ForecastCategory":"Omitted","Converted_From_Lead_ (2 more) ...":false,"Close_Date_Missing__ (1 more) ...":false,"CloseDate":"2017-03-31T00:00:00.000Z","mh_Associated_Blue_S (7 more) ...":false,"Name":"42 Riot- tester 19","PLM_Review__c":false,"Teleservices_Total__ (1 more) ...":0.00,"CreatedById":"0050P000006jNqqQAE","Stage_Validation_SOW (12 more) ...":"Not SOW Received","Marketing_Technology (9 more) ...":0.00,"CSM_Assigned__c":false,"Lead_Created_DateTim (4 more) ...":"2017-01-04T22:27:46.000Z","Internal_Approval_Da (10 more) ...":"2017-01-05T00:00:00.000Z","SmartForms__c":false,"Data_Total__c":0.00,"IsDeleted":false,"Commit_Probability__ (1 more) ...":"Low","Billing_Address__c":"3710 W Mission Lane_ (39 more) ...","Open_Won_Lost__c":"Open","Contact_Missing__c":false,"Setup_Management_Tot (5 more) ...":0.00,"Digital_Total__c":0.00,"Inbound_Support_Tota (4 more) ...":0.00,"CreatedDate":"2017-01-05T17:57:19.000Z","mh_Managers_Notes_Ex (6 more) ...":false,"Id":"0065C000002Q95UQAS","Data_Quality_Score__ (1 more) ...":40,"ForecastCategoryName":"Omitted","Dialogue_Total__c":0.00,"Research_Total__c":0.00,"Dialogue_Total_No_Ca (9 more) ...":0.00,"IsClosed":false,"Opportunity_Amount__ (1 more) ...":0.00,"Clients_Validation__ (1 more) ...":false,"Data_Quality_Descrip (7 more) ...":"Missing: Type, Lead (18 more) ...","OwnerId":"0050P000006jNqqQAE","Lead_Create_Date__c":"2017-01-04T22:27:46.000Z","IsWon":false,"RecordTypeId":"012U00000000GAPIA2","StageName":"Long Range Forecast","Engagement_Planning_ (8 more) ...":0.00,"Probability":0,"Stage_Validation_Clo (10 more) ...":"Not Closed Won","mh_Additional_Notes_ (8 more) ...":false,"Stage_Missing__c":false,"Analytics_Total__c":0.00,"Reporting_Total__c":0.00,"SystemModstamp":"2017-01-05T17:57:19.000Z","Associated_Budget_Al (6 more) ...":"_IM1_/servlet/servle (117 more) ...","Viewpath__Viewpath_P (17 more) ...":"_HL_ENCODED_/_HL_ _H (11 more) ...","No_Owner_Match__c":false,"Marketing_Total__c":0.00,"IsPrivate":false,"LastModifiedById":"0050P000006jNqqQAE"}}}|0x23edca8f
10:57:19.312 (367468336)|VARIABLE_SCOPE_BEGIN|[67]|isInsert|Boolean|false|false
10:57:19.312 (367473388)|VARIABLE_ASSIGNMENT|[67]|isInsert|true
10:57:19.312 (367475977)|VARIABLE_SCOPE_BEGIN|[67]|isDelete|Boolean|false|false
10:57:19.312 (367478436)|VARIABLE_ASSIGNMENT|[67]|isDelete|false
10:57:19.312 (367485659)|SYSTEM_MODE_ENTER|false
10:57:19.312 (367489533)|HEAP_ALLOCATE|[68]|Bytes:5
10:57:19.312 (367493471)|STATEMENT_EXECUTE|[67]
10:57:19.312 (367494934)|STATEMENT_EXECUTE|[68]
10:57:19.312 (367499229)|HEAP_ALLOCATE|[68]|Bytes:4
10:57:19.312 (367522697)|VARIABLE_SCOPE_BEGIN|[68]|changedOpps|Map<Id,Opportunity>|true|false
10:57:19.312 (367534685)|VARIABLE_ASSIGNMENT|[68]|changedOpps|{"s":1,"v":{}}|0x7334ae8
10:57:19.312 (367538219)|STATEMENT_EXECUTE|[70]
10:57:19.312 (367539341)|STATEMENT_EXECUTE|[71]
10:57:19.312 (370810546)|VARIABLE_ASSIGNMENT|[71]|changedOpps|{"s":1,"v":{"0065C000002Q95UQAS":{"LastModifiedDate":"2017-01-05T17:57:19.000Z","Sales_Order__c":false,"Data_Intelligence_To (6 more) ...":0.00,"AccountId":"0015C000002ZR9XQAW","HasOpportunityLineIt (2 more) ...":false,"Billing_Information_ (12 more) ...":false,"No_Origninal_Account (6 more) ...":false,"ForecastCategory":"Omitted","Converted_From_Lead_ (2 more) ...":false,"Close_Date_Missing__ (1 more) ...":false,"CloseDate":"2017-03-31T00:00:00.000Z","mh_Associated_Blue_S (7 more) ...":false,"Name":"42 Riot- tester 19","PLM_Review__c":false,"Teleservices_Total__ (1 more) ...":0.00,"CreatedById":"0050P000006jNqqQAE","Stage_Validation_SOW (12 more) ...":"Not SOW Received","Marketing_Technology (9 more) ...":0.00,"CSM_Assigned__c":false,"Lead_Created_DateTim (4 more) ...":"2017-01-04T22:27:46.000Z","Internal_Approval_Da (10 more) ...":"2017-01-05T00:00:00.000Z","SmartForms__c":false,"Data_Total__c":0.00,"IsDeleted":false,"Commit_Probability__ (1 more) ...":"Low","Billing_Address__c":"3710 W Mission Lane_ (39 more) ...","Open_Won_Lost__c":"Open","Contact_Missing__c":false,"Setup_Management_Tot (5 more) ...":0.00,"Digital_Total__c":0.00,"Inbound_Support_Tota (4 more) ...":0.00,"CreatedDate":"2017-01-05T17:57:19.000Z","mh_Managers_Notes_Ex (6 more) ...":false,"Id":"0065C000002Q95UQAS","Data_Quality_Score__ (1 more) ...":40,"ForecastCategoryName":"Omitted","Dialogue_Total__c":0.00,"Research_Total__c":0.00,"Dialogue_Total_No_Ca (9 more) ...":0.00,"IsClosed":false,"Opportunity_Amount__ (1 more) ...":0.00,"Clients_Validation__ (1 more) ...":false,"Data_Quality_Descrip (7 more) ...":"Missing: Type, Lead (18 more) ...","OwnerId":"0050P000006jNqqQAE","Lead_Create_Date__c":"2017-01-04T22:27:46.000Z","IsWon":false,"RecordTypeId":"012U00000000GAPIA2","StageName":"Long Range Forecast","Engagement_Planning_ (8 more) ...":0.00,"Probability":0,"Stage_Validation_Clo (10 more) ...":"Not Closed Won","mh_Additional_Notes_ (8 more) ...":false,"Stage_Missing__c":false,"Analytics_Total__c":0.00,"Reporting_Total__c":0.00,"SystemModstamp":"2017-01-05T17:57:19.000Z","Associated_Budget_Al (6 more) ...":"_IM1_/servlet/servle (117 more) ...","Viewpath__Viewpath_P (17 more) ...":"_HL_ENCODED_/_HL_ _H (11 more) ...","No_Owner_Match__c":false,"Marketing_Total__c":0.00,"IsPrivate":false,"LastModifiedById":"0050P000006jNqqQAE"}}}|0x23edca8f
10:57:19.312 (370853951)|STATEMENT_EXECUTE|[83]
10:57:19.312 (370855993)|STATEMENT_EXECUTE|[85]
10:57:19.312 (370860519)|HEAP_ALLOCATE|[85]|Bytes:133
10:57:19.312 (370866361)|HEAP_ALLOCATE|[85]|Bytes:4
10:57:19.312 (370896080)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8
10:57:19.312 (370903087)|HEAP_ALLOCATE|[85]|Bytes:8
10:57:19.312 (381436270)|SOQL_EXECUTE_BEGIN|[85]|Aggregations:0|SELECT Id, Related_Opportunity__c, Opportunity_Stage_text__c FROM Campaign_Design_Profile__c WHERE Related_Opportunity__c IN :tmpVar1
10:57:19.312 (383751334)|SOQL_EXECUTE_END|[85]|Rows:0
10:57:19.312 (383770039)|HEAP_ALLOCATE|[85]|Bytes:4
10:57:19.312 (383778104)|HEAP_ALLOCATE|[85]|Bytes:0
10:57:19.312 (383825218)|HEAP_ALLOCATE|[85]|Bytes:4
10:57:19.312 (383834511)|VARIABLE_SCOPE_BEGIN|[85]|lstCDP|List<Campaign_Design_Profile__c>|true|false
10:57:19.312 (383848383)|VARIABLE_ASSIGNMENT|[85]|lstCDP|{"s":1,"v":[]}|0x352f4086
10:57:19.312 (383960435)|HEAP_ALLOCATE|[87]|Bytes:5
10:57:19.312 (383974678)|VARIABLE_ASSIGNMENT|[87]|cdp|null|
10:57:19.312 (383978299)|STATEMENT_EXECUTE|[87]
10:57:19.312 (383979955)|STATEMENT_EXECUTE|[93]
10:57:19.312 (384014169)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
10:57:19.312 (384021620)|SYSTEM_MODE_EXIT|false
10:57:19.312 (384029582)|METHOD_EXIT|[11]|01pU00000008K9w|OpportunityTrigger.updateStageName(Map<Id,Opportunity>, Map<Id,Opportunity>, Boolean, Boolean)
10:57:19.384 (384037846)|CUMULATIVE_LIMIT_USAGE
10:57:19.384 (384037846)|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 4 out of 100
Number of query rows: 10 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Maximum CPU time: 0 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
Flow error email:
An error occurred at element myRule_1_A1 (FlowRecordUpdate).
UPDATE --- UPDATE FAILED --- ERRORS : (FIELD_INTEGRITY_EXCEPTION) Lead: id value of incorrect type: 0065C000002Q95UQAS
We welcome your feedback on IdeaExchange (https://success.salesforce.com/ideaSearch).
Flow Details
Flow Name: Lead_ID_Update_Opportunity
Type: Workflow
Version: 2
Status: Active
Flow Interview Details
Interview Label:
Current User: Joshua Anderson (0050P000006jNqq)
Start time: 1/5/2017 10:57 AM
Duration: 0 seconds
How the Interview Started
Joshua Anderson (0050P000006jNqq) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = 00Q5C000000ya6yUAA
myVariable_current = 00Q5C000000ya6yUAA
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "1/5/2017 10:57 AM"
DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!formula_myRule_1} (true) Equals true
Logic: All conditions must be true (AND)
RECORD UPDATE: myRule_1_A1
Find all Opportunity records where:
Id Equals {!myVariable_current.ConvertedOpportunityId} (0065C000002Q95UQAS)
Update the records’ field values.
Lead__c = {!formula_2_myRule_1_A1_Lead_c} (0065C000002Q95UQAS)
Result
Failed to update records that meet the filter criteria.
It looks like there is an attempt to save an opportunity id to a lead lookup field that is expecting a record id for the lead.
Lead ids start with 00Q
Opportunities ids start with 006
In your record update action, set the Opportunity.Lead__c = Lead.Id
As a side note, it looks like you have a number of workflow rules in your org. You may want to consider refactoring all of the lead workflow rules into one process builder process and do the same thing with the opportunity process builders.
A better approach long term so you won't have to lock out your users and disable business rules is to add bypass logic to all of your business rules. The bypass logic allows you to run data loads for the data migration user without firing the business logic.
An example on how toTo do this,
SBC Global Technical Support TollFree Number
SBC Global Customer Care Phone Number
SBC Global Helpline Number
SBC Global Customer Service Phone Number
SBC Global Customer Service TollFree Number
SBC Global TollFree Number
SBC Global Contact Number
SBC Global Support Number
SBC Global Customer Support Number
SBC Global Help Number
SBC Global Customer Care
SBC Global Customer Support