Posts

Showing posts with the label unique

Salesforce Fact #905 | Unique Leadsource from related contacts

Image
In this blog post, I have created a screen flow to find out the unique Leadsource of related contacts for an account record. Here are the steps: 1) First we are getting the related contact records where the LeadSource is not blank for that account. Also, we are ordering the result ascending by leadsource for later processing. 2) Then we are checking if any data is found. If data is not found, showing an error screen. 3) If data is found, we are running a loop on the fetched records and checking if the previous value and current value is the same. This check is to make sure we are getting unique values and skipping the duplicate values. 4) At the end, we are showing the data in the datatable. Note: If the number of related contacts are huge, then we need to revisit this solution to avoid hitting any limits. Attached are the screenshots.

Salesforce Fact #777 | Data uniqueness violation

Have you encountered this error: The proposed data changes would violate a uniqueness constraint. If you try to create a custom label with the same name of an existing label, this error is shown. The same error can be encountered while updating approval process. Reference:  https://help.salesforce.com/s/articleView?id=000386951&type=1

Salesforce Fact #10 | record name field

The record name field acts like a unique field. The possible data types are text or auto-number. When the field is of text type, the field is required while entering data through the UI. But it is optional while inserting data through API or import tool. If we do not provide a value for this field, it will store the record Id of the record. When the field is of auto-number type, we specify the pattern. We can also reset the numbering so that it again starts from the first value. To do this, first we need to convert the type to text and again convert it to auto-number.