Validation Rules and Roll-Up Summary Fields

Maybe you all know it but it took me by surprise. I know order of execution but realized it some times ago. Validation Rules run before Roll-Up fields calculation. If you use roll-up summary fields in the validation rules then be ready - it can work unexpectedly. Validation rules will be executed with updated data only next time when someone update the record. Be careful when using roll-up summary fields in the validation rules.

Useful links:

Component.find behavior that you know but may not comply with

Probably, you know that the find() method may return a single object or a list object. But I realized that many developers do not carry about cases when the find() method may return only one object and it causes the ".forEach is not a function" error. It happens because the find() method found only one match, and in this case, return a single object. That was why the forEach() method is not a function for an object, it's only available for lists. However, there exists a simple workaround how to fix that :)

let myResult = component.find("myParam");
myResult = [].concat(myResult);
// myResult is a list now, and you can use the forEach() method

Useful links:

UNKNOWN_EXCEPTION, INVALID_TYPE: sObject type 'SalesforceIqDataSource' is not supported.

Why is it failing now? We do not change code for the long period
It starts failed after activation the "Einstein Activity Capture" feature.

What functional is affected by this issue?
It affects only the send email functionality for the site guest user. So, if you have force.com site and it calls apex code to send an email, then the logic will fail. Please note that workflow email alerts work successfully, affected only apex part.

Are there any workarounds?
You can deactivate the "Einstein Activity Capture" feature but if it is not a solution, then log a Salesforce case. Please note that support can help you only if you have Premier Customer Support. In this case, please ask them to whitelist the SalesforceIqDataSource object. Whitelisting for the guest user is performed by the Developer Team, and this is available only to Premier Customer.

Useful links:

Einstein Activity Capture Surprise

Do you know that you cannot query Einstein Activities from Apex? Yes, that's actually true. You cannot query them in SOQL, also you cannot create an Apex Trigger for them. Activities added to Salesforce with Einstein Activity Capture aren't available in the API. From my point of view, it's because of these activities stored outside of Salesforce.

Useful links:

Getting #Error in a formula field when using exponentiation

Do you know that power should be integer number? Otherwise, you will get #Error in a formula field. It was a surprise for me because I didn't find something like POW or POWER function that accepts double power value. Luckily, Salesforce support EXP(returns the value of e to the specific power) and LN(returns the natural logarithm) functions in formula fields. Now when we know it all, let's think about how we can use it.

Mathematics will help us, based on the information that e ^ (ln a) = a, we can rewrite a ^ b to the next format:

A ^ B = e ^ (B * ln(A)) = EXP(B * LN(A))

Useful links: