You need to sign in to do that
Don't have an account?
Trigger development - Please Help
I am trying to get a Status field to update when two other fields equal. I am not getting any errors with my code, however it does not seem to be working properly. Please take a look and let me know your thoughts!
Thank you,
Thank you,
Trigger trigger Read on Web_Links__c (before update){ StatusRead.Read(Trigger.new); } Class public class StatusRead { public static void Read(List<Web_Links__c> WI){ Web_Links__c WL = [SELECT status__c FROM Web_Links__c]; if(WL.Owner_ID__c == WL.Last_user_to_view_record__c){ WL.status__c = 'Read'; update WL; } } }
All that you need is this. Since it's a pretty straightforward one, you don't need to build the logic in a separate class. Also, when trying to update in before update mode, Trigger.New is writeable which means you can directly make the changes in the List and need not perform a separate DML operation. Kindly mark it as an answer if this is what you were looking for !
All Answers
All that you need is this. Since it's a pretty straightforward one, you don't need to build the logic in a separate class. Also, when trying to update in before update mode, Trigger.New is writeable which means you can directly make the changes in the List and need not perform a separate DML operation. Kindly mark it as an answer if this is what you were looking for !
However, what I am trying to accomplish is when a user enters a record they own I need the status to change. For that, the trigger is not working unless the user updates something in the record. How can I get this trigger to work with a user not doing anything to the record? I modified the trigger slightly to reflect.
Triggers are invoked only when a record is modified. So no matter what, unless a record is changed, the trigger cannot be invoked.