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

Simple Trigger Help Needed

I know that it can be annoying to see the questions from those of us who are new to this, but any help is appreciated. I am trying to accomplish, what I believe to be a rather simple apex trigger. I have spent over 9 hours today alone trying to locate an example that is similar to mine and have found nothing remotely close.


I am trying to accomplish a field update on a custom object triggered by an update on a record from the same object. We have a custom object called deposit accounts. I want the trigger to fire when a deposit account record's field of status is changed to "Accepted". Once that happens, I want the trigger to search all deposit accounts for ones that have a matching name and type field and update the status on those records as well.


I thought this would be simple since I am not going cross object and am only trying to update 1 field on multiple records within this same object. I have tried writing this at least 10 times and fail at each corner. I am under a time crunch at work and any help that you provide will be awesome!


Please try the following:-


trigger Upd_DepositAcc on DepositAccount__c (before update) {
integer i;
if(Trigger.size == 1)
if([0].status<>Trigger.old[0].status &&[0].status=='accepted')
 DepositAccount__c[] temp=[Select id, name, status from DepositAccount__c where[0].name and[0].type];
  update temp;


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.