You need to sign in to do that
Don't have an account?
Eric Pohlabel
Update Case Owner to a Value in an Account field
Decent admin - complete newbie when it comes to coding. I am attempting to solve my very first real live org problem using a trigger. This is going to be the first “non-tutorial” trigger I have ever written and it might be a bit more than I bargained for. Here is the scenario:
I have a lookup to User on the Account object “SRM__c”. When SRM__c is populated – I need to update the Case Owner to the User populated in SRM__c for every OPEN case that is related to the Account.
Then I think I need the UserID of the User that is populated in the Account.SRM field but I have no idea what the syntax for that should be. Im also not sure that I can use both the Case and Account objects in the same IF statement. HELP!!!!!
I have a lookup to User on the Account object “SRM__c”. When SRM__c is populated – I need to update the Case Owner to the User populated in SRM__c for every OPEN case that is related to the Account.
trigger updateRelatedSRMCaseOwner on Account (after insert, after update){ for (Case c : Trigger new){ if (c.isClosed = FALSE && NOT(ISBLANK(Account.SRM))){ c.OwnerID = Account.SRM; update c; } } }I don’t think I can run the trigger on Account object…then have the FOR loop looking for CASES can I?
Then I think I need the UserID of the User that is populated in the Account.SRM field but I have no idea what the syntax for that should be. Im also not sure that I can use both the Case and Account objects in the same IF statement. HELP!!!!!
This seems like something process builder should be able to take care of. I would look into that before trying to write a trigger.
Having said that, the trigger should look something like the following:
All Answers
This seems like something process builder should be able to take care of. I would look into that before trying to write a trigger.
Having said that, the trigger should look something like the following: