Timeline for Database.upsert - how to find which records have inserted/updated based on ExternalId
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 6, 2018 at 21:45 | comment | added | sfdcfox♦ | @krigi Who I don't recall, it was when it was first announced and there was a speaker Q&A. You're right that you can depend on in within the same class in the same transaction, but I think the problem is that there's no guarantee if you use multiple transactions (e.g. in a visualforce controller in multiple action methods). I don't have a concrete example, but I'll see if I can find out more. | |
Dec 6, 2018 at 19:00 | comment | added | krigi | @sfdcfox thanks for the response. But who told us not to depend on this patch always working? ... "You can rely on the order being the same in each subsequent execution of the same code." to me this reads pretty plain... if we call MapAlpha.values() N times... we will receive the same, ordered list each time. Have you observed different behavior? If this method does not work as advertised, SFDC needs to rework their docs :) | |
Dec 6, 2018 at 5:29 | comment | added | sfdcfox♦ | @krigi Yes, I'm aware of that, but we've also been told not to depend on this patch always working (note that the docs say "You can rely on the order being the same in each subsequent execution of the same code."). It does help in common use cases, but I still wouldn't recommend depending on it without testing edge cases, like when passing records between classes in different API versions, etc. | |
Dec 6, 2018 at 0:38 | comment | added | krigi | We do know order, even if we use a values() call on a Map. Per the documentation (developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…), calling the values() method yields a deterministic list... each call will yield the same list in the same order. It has been this way since Summer ’15 release. | |
Aug 20, 2017 at 20:20 | comment | added | Santanu Boral | please find my answer, I have taken this approach | |
Aug 19, 2017 at 15:12 | vote | accept | Santanu Boral | ||
Aug 19, 2017 at 3:16 | history | answered | sfdcfox♦ | CC BY-SA 3.0 |