Posts

Showing posts with the label update

Salesforce Fact #853 | Sobject update fact

Image
In apex, if we add an sobject record to a list and then update any of the field value the final list would include that value. But that's not the case in case of flow. In this example, we are adding an account record to a list and then updating the rating to 'Cold'. After DML is made on the list, the account rating would be 'Cold'. In case of flow, it doesn't update the rating. Note: As a best practice, always make the necessary updates to sobject record and finally add to the list. The above example is only for demonstration purpose and should not be followed.

Salesforce Fact #621 | Restrict owner update in case of manual sharing records

Image
In context of the last post, suppose we want to put a validation that if the account records have existing manual sharing records then the owner cannot be changed. We can implement the same using trigger logic. Attached is the screenshot. Note: The code snippet is only for demonstration purpose and coding best practices have not been covered.