You need to sign in to do that
Don't have an account?
uHaveOptions
Error:
Line: 2, Column: 14
No such column 'My_Last_Call__c' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Any advise to fix that issue?
Error Performing Open Execute Anonymous Window Update AllRecords
Hello All,
I currently have this APEX Trigger which i am tryng to perform a Update records so the field populates properly. I am performing a Open Execute in the developer console but getting an error..
trigger MyLastCallDate on Task (after insert, after update, after delete) { public String currentUser = UserInfo.getUserId(); public String oldUser=[select old_ID__c from User where id=:currentUser limit 1] [0].old_ID__c; Set<Id> con_set = new Set<Id>(); List<Contact> con_list = new List<Contact>(); for( Task T: Trigger.new ) { { con_set.add(T.whoid); } } for(AggregateResult aggregateResult:[SELECT max(createdDate)MaxCDate,whoid FROM Task WHERE whoid IN: con_set AND Status ='Completed' AND (subject LIKE 'call%' OR subject LIKE 'outbound%') AND (CreatedbyId=:currentUser OR OLDOWNERID__C=:oldUser) group By whoid]) { con_list.add(new Contact(Id=(id)aggregateResult.get('whoid'),My_Last_Call__c=date.valueof(aggregateResult.get('MaxCDate')))); } try { if(con_list !=null && con_list.size()>0) { update con_list; } }Catch(Exception ee){ system.debug('Exception ***'+ee.getMessage()); } }
Error:
Line: 2, Column: 14
No such column 'My_Last_Call__c' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Any advise to fix that issue?
Did you write the trigger on Developer Console??? If yes, then it's wrong, you can't write triiger on Developer console. Only the statements can be executed from the developer console.
What you can do -
1) Write this trigger on the task Object.
2) Create a dummy field on task - Let's say "One time update" : data type - Checkbox.
On the Developer console, execute this script -
Hope, it will help you.
Thanks,
Sumit Kumar Singh
You are referring "My_Last_Call__c" in your trigger . As this field should exist on contact about , Check your object once.
That's the purpose.
Thanks,
Sumit Kumar Singh
Ok I created the field in Task and it's in the Layout. It gave me this error after putting a limit
Line: 6, Column: 1
System.LimitException: Too many DML rows: 10001
thoughts?
Now, Here one more role of check box comes into picture.
We can put where clause on this checkbox to get the remaining records to be updated.
Let's say, you have total 100K records in the Task, then run this script 10 times to update all the records. Let me know if it helps you.
Thanks,
Sumit Kuamr Singh
It's giving me this error.
Line: 24, Column: 1
System.LimitException: Too many DML rows: 10001
hahaha im pulling my hair
hahaha but after running it the second time it gave me System.LimitException: Apex CPU time limit exceeded
Line: 9, Column: 1
System.LimitException: Apex CPU time limit exceeded
OR you can write a batch to update the records. After successful audation you can delete the batch.