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
Shivom Verma 34Shivom Verma 34 

Trigger to Update a field on case record when a new note is inserted.

i tried lots of time but it is not working in case object 
anyone help my why it is not working in case object
 
Best Answer chosen by Shivom Verma 34
Malika Pathak 9Malika Pathak 9

Hi Shivom

 

this is handler when we insert a note on the contact
it will update the case field product (picklist)

trigger TriggerNote on Note (after insert) {
    
    HandlerTriggernote handler = new HandlerTriggernote();
    handler.Insertnote(trigger.new);

}

here is the handler code for update 
please change product__c according to your need.

public class HandlerTriggernote {
public void Insertnote(list<note>listnote){

list<case> listcase = new list<case>();
listcase = [SELECT id,Product__c FROM case ];
for(case c:listcase)
{
c.Product__c = 'GC3040';
}
update listcase;

}

}

 

if you find this helpful mark it as the best answers.