I'm not sure what solution is better, but what I intend to do is develop a method in the apex controller which makes a callout to a private API.

That callout needs to send the contact's emails, but I don't know if it's better to send the Id of the contact and then query the emails in the server side controller VS use force:recordData and simply send the emails as parameters to the Apex controller.

The first solution looks nicer component wise, but it also adds a query to the Apex controller. Not sure which to prioritize. Any ideas?


It doesn't matter. The benefits either way are insignificant. You can save up to a couple of hundred bytes of data transfer by sending an ID, and make sure you have the most recent data from the database, but emails are fairly static, often lasting for years or decades at a time, so it's not likely that you're going to use the wrong email address by not querying the database, and most cases, a few hundred bytes of bandwidth are insignificant. Overall, this would fall in the micro-optimization bucket of code changes; unless you experience a real problem using either solution and need to change it, it simply doesn't matter.

  • Fair enough. I was wondering if it had any implicit stuff that I did not know of. I don't really know the implications of using force:recordData, more than loading the record's data in memory. Thanks for the answer! – Javier García Manzano Apr 6 '18 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.