Timeline for Apex Trigger not Firing on Mass Update
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 19, 2017 at 5:57 | comment | added | sfdcfox♦ |
@Brandon Should have been updateAccounts[index] . If you don't need it, don't worry about it, but it's been updated now. Glad I could help.
|
|
Aug 19, 2017 at 5:56 | history | edited | sfdcfox♦ | CC BY-SA 3.0 |
added 7 characters in body
|
Aug 19, 2017 at 5:55 | vote | accept | Brandon | ||
Aug 19, 2017 at 5:55 | comment | added | Brandon |
@sfdcfox - the main code appears to compile perfectly now. Giving it a go! I did notice that there's a separate compile issue if including the optional error reporting. Error: Compile Error: Initial term of field expression must be a concrete SObject: List<Account> at line 40 column 23 . Thanks again for your support!
|
|
Aug 19, 2017 at 5:50 | comment | added | sfdcfox♦ |
@Brandon Looks like there was an extra } in the code, too. I didn't compile this since I don't have your custom fields. An error like "Unexpected token X" usually means a misplaced } , ; , or ) .
|
|
Aug 19, 2017 at 5:48 | history | edited | sfdcfox♦ | CC BY-SA 3.0 |
deleted 6 characters in body
|
Aug 19, 2017 at 5:46 | comment | added | Brandon |
Thank you, @sfdcfox! Getting close here I believe. I am now seeing a compile issue with the Database.SaveResult[] line. The error message says: Error: Compile Error: unexpected token: Database.SaveResult at line 36 column 4 . Doing my best to understand what may be happening. Thanks again!
|
|
Aug 19, 2017 at 5:39 | history | edited | sfdcfox♦ | CC BY-SA 3.0 |
added 1 character in body
|
Aug 19, 2017 at 5:37 | comment | added | Brandon |
@sfdcfox - thanks again for your assistance. I'm getting the following compile error. Error: Compile Error: Didn't understand relationship 'Contact' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 19 column 25 . Any ideas as to what may be happening? Thanks again!
|
|
Aug 19, 2017 at 4:52 | comment | added | sfdcfox♦ |
@EricSSH Using if(!empty) { code } means you don't need to write a "negative unit test", but will indent all of your code by an additional level, which makes makes it harder to read if you do this repeatedly-- if(...) { if(...) { if(...) is three levels of indentation, while if(...) ... if(...) ... if(...) ... is only 1. It's really a matter of preference and/or coding styles. There's pros and cons to both.
|
|
Aug 19, 2017 at 4:44 | comment | added | Brandon | Terrific! I'll give it a shot. Thank you, @sfdcfox ! | |
Aug 19, 2017 at 4:43 | comment | added | EricSSH |
Thanks for the explanation, what are the implications if you were to wrap that accountIds.isEmpty() in !accountIds.isEmpty() I think I'm nit picking you just trying to soak it in.. I know it's all personal preference, but is it just habit that you like to do or is there a reason behind it?
|
|
Aug 19, 2017 at 4:41 | comment | added | sfdcfox♦ | @EricSSH If a transaction has only "private" contacts, we don't want to continue on. This saves a query and a sub-query (governor limits, you know). Then again, this may be considered a trivial amount of processing, and you just don't care (not everyone will). This is just how I'd write this. | |
Aug 19, 2017 at 4:36 | comment | added | EricSSH | What is the benefit to return; isn't it somewhat redundant at that point? | |
Aug 19, 2017 at 4:35 | history | answered | sfdcfox♦ | CC BY-SA 3.0 |