You need to sign in to do that
Don't have an account?

Trigger Missing Test Class
Hi. My trigger failed to deploy. I believe it's missing a test class. I'm unsure how to do this.
This is my trigger:
trigger updateAccountField on Note (after insert) {
List<Account> accUpdate = new List<Account>();
for(Note n : Trigger.new){
if(n.ParentId != null && n.ParentId.getSObjectType() == schema.Account.sObjectType){
Account acc=new Account(Id=n.parentId,Most_Recent_Note_Date__c=n.CreatedDate, Most_Recent_Note_Body__c=n.Body,Most_Recent_Note_Title__c=n.Title);
accUpdate.add(acc);
}
}
if(accUpdate.size()>0){
update accUpdate;
}
}
This is the failed message:

This is my trigger:
trigger updateAccountField on Note (after insert) {
List<Account> accUpdate = new List<Account>();
for(Note n : Trigger.new){
if(n.ParentId != null && n.ParentId.getSObjectType() == schema.Account.sObjectType){
Account acc=new Account(Id=n.parentId,Most_Recent_Note_Date__c=n.CreatedDate, Most_Recent_Note_Body__c=n.Body,Most_Recent_Note_Title__c=n.Title);
accUpdate.add(acc);
}
}
if(accUpdate.size()>0){
update accUpdate;
}
}
This is the failed message:
All Answers
Try this below test class --
Thanks
Akshay
Error: Compile Error:
SELECT Most_Recent_Note_Date__c, Most_Recent_Note_Body__c
^
ERROR at Row:1:Column:8
No such column 'Most_Recent_Note_Date__c' on entity 'Opportunity'. 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. at line 17 column 24
See image below:
Error: Compile Error: Variable does not exist: nt at line 18 column 54
See image below:
Unable to Access Page
The value of the "id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.