Salesforce ISCLONE Function

The Salesforce ISCLONE Function is used to check whether a record already exists in the Salesforce org.

ISCLONE Function in Salesforce is one of the commonly used functions in the Salesforce validation rule, but there is no online tutorial that covers the concept of the ISCLONE function and how to use it in the validation rule.

In this Salesforce tutorial, I will guide you as a Salesforce Administrator on what the ISCLONE function is, its syntax, considerations, etc. I will also explain step-by-step how to use the ISCLONE function in Salesforce Lightning and Salesforce Classic.

ISCLONE Function in Salesforce

What do we mean by the ISCLONE function in Salesforce?

The ISCLONE function in Salesforce is one of the Salesforce logical functions used to guarantee data integrity and data uniqueness.

It is a function that is used to determine whether a record is a clone of another record or not. It evaluates the result to TRUE if the record is a clone of another record, but if the same record already exists, the function will return FALSE.

Where in Salesforce can we use the ISCLONE function?

The Salesforce validation rules include the ISCLONE function. This function functionality is not available in the formula fields.

Additionally, we can use the ISCLONE function in the Salesforce process builder, record triggers, workflow rules, etc.

In Salesforce, how can the ISCLONE function be written?

The following is the Salesforce syntax for the ISCLONE function.

ISCLONE()

How many parameters does the ISCLONE function receive in Salesforce?

It is important to remember that the ISCLONE function accepts no parameters. This function is also cannot be used with fields.

Additionally, if we pass any field as a parameter to the function, the function will return an error such as “Incorrect number of parameters for function ‘ISCLONE().’ Expected 0, received 1”.

Is there any consideration that we must take care of while working with the ISCLONE function in Salesforce?

Yes, if we want to get the reverse result of the ISCLONE function, we need to use the NOT function with the function. The use of the NOT function reverses the return values of TRUE and FALSE.

How to use the ISCLONE Function in Validation Rule in Salesforce Lightning

Let’s try to understand with the example that you want to create a lead with the same lead record in Salesforce. The following are the steps to use the ISCLONE function in the validation rule in Salesforce Lightning.

Step-1: Access your Salesforce account in the Lightning Interface using your credentials. If you are not on the “Home Setup” page, move your cursor over the “Gear” icon on the right side of the screen, click it, and select “Setup” dropdown menu.

See also  Salesforce CURRENCYRATE Function

Step-2: Locate and select the “Object Manager” option from the navigation bar. Select the object for which you want to create the validation rule.

For example, as per the scenario, you need to find and select the “Lead” object.

Salesforce ISCLONE Function

Step-3: Under the selected object on the left sidebar, search for and click on “Validation Rules”.

After that, click on the “New” button given at the top right side of the page to create the rule for the lead object.

Salesforce ISCLONE Function Example

Step-4: Now define the rule details by filling up the required details:

  • Rule Name: Specify the name of your validation rule. Make sure that the validation rule has a descriptive name.
  • Description: If you want, you can provide a brief description of the rule.

After that, check the “Active” checkbox to activate the validation rule. According to the scenario, you can enter the rule name as “Lead Creation Uniqueness”.

ISCLONE Function in Salesforce

Step-5: In the “Formula” section, you will define the criteria that evaluate the validation rule. If this formula expression is true, display the text defined in the Error Message area.

As per the scenario, you want that no duplicate lead record can be created. To enter the formula, click on the “All Function Categories”, -> click on “Logical”, -> select the “ISCLONE” function, -> click on “Insert Selected Function”.

The formula for this scenario is as follows:

ISCLONE()
  • Here, the ISCLONE function checks if the record is a clone of another record, and even if one item is a clone, it returns TRUE.

Note: If you are creating the same record by typing the same data in the fields, it will not be considered as the clone record. The record will only be treated as the clone record if you use the “Clone” option to create its copy.

After entering the error condition formula, click the “Check Syntax” button to make sure the formula is error-free. As soon as you see the success message, “No errors found”, move on to the next step.

ISCLONE Function in Salesforce Example

Step-6: In this step, enter the error message that will appear when the validation rule is activated. It is used to explain to users why their data entry attempt was unsuccessful at the moment.

According to the situation, the error notice will appear if the same lead record already exists. You can enter the error message as given below:

Lead with this record already exists. Please enter a unique record.

After that, specify the location where the error message will display by choosing the desired option from the “Enter Location” checkbox field.

You can display the message either on the top of the page or below the field, but if there is more than one error message, the error message always displays at the top of the page.

See also  Salesforce NOT Function

Step-7: Finally, click on the “Save” button to save your validation rule.

Salesforce Lightning ISCLONE Function

Step-8: Once the validation rule is created, you can check how it works.

  • Open the “Leads” object, create the new lead with the necessary fields, or clone a record using the “Clone” option and save it.
  • If the lead record is unique, it gets saved successfully. Otherwise, an error message will be displayed, and the record won’t be saved until the error is resolved.
Salesforce Lightning ISCLONE Function Example

Let’s deeply understand it with the example:

  • Suppose you have an already created lead in Salesforce, and now you want to create the same lead record by using the “Clone” button.
  • When you click on the clone button, the validation rule executes and checks that a similar record exists. Therefore, it generates an error “Lead with this record already exists. Please enter a unique record.”.
ISCLONE Function in Salesforce Lightning

With this, we have learned how to use the ISCLONE function in Salesforce Lightning.

How to use the ISCLONE Function in Salesforce Classic

Using the example that you wish to create a contact with an identical contact record in Salesforce. The steps to utilize the Salesforce Classic validation rule’s ISCLONE function are as follows.

Step-1: Login to the Salesforce account by entering the administrator username and password in the Classic Interface.

After logging in, you will be directed to the Salesforce home page. In the top-right corner, click on the “Setup” option. If you don’t get the option here, click on your username, and from the dropdown menu, select “Setup”.

Salesforce Classic ISCLONE Function

Step-2: Locate on the left-hand side the “Build” section, then expand the “Customize” dropdown and choose the object on which you want to use the desired function.

From the expanded options, click on the “Validation Rules” option.

Salesforce Classic ISCLONE Function Example

Step-3: To define one or more validation rules that consist of an error condition and corresponding error message, click on the “New” button on the validation rules page.

Step-4: Now provide “Rule Name” and “Description” that explain the purpose of the validation rule. According to the scenario, you can enter the rule name as “Duplicate Contact Record”.

Set the “Active” checkbox to true to activate the validation rule. If this checkbox is not selected, the rule will not work.

ISCLONE Function in Salesforce Classic Example

Step-5: In the “Enter Condition Formula” section, you need to define the criteria that, when met, the validation rule gets triggered. Use the formula editor to create your formula.

To define the formula, select the necessary function category by clicking on the “All Functions Categories” dropdown menu. According to the scenario, you need to choose the “Logical” category of the function.

Then, look and select the “ISCLONE” function. After that, select the functions and click the “Insert Selected Function” button.

See also  Salesforce YEAR Function

According to the scenario, the formula is as given below:

ISCLONE()
  • The ISCLONE function in Salesforce is used to check whether a record is a clone of another record. It returns TRUE if the record is a clone and FALSE otherwise.
  • It is important to keep in mind that entering the same data into fields when creating a new record will not trigger the ISCLONE function. A record is considered a clone if it is created using the “Clone” option in Salesforce.

To verify the syntax of the formula you type, click the “Check Syntax” button. If there is an error, it will give an error message; otherwise, the formula exceeded successfully.

ISCLONE Function in Salesforce Validation Rule

Step-6: In the “Error Message” field, enter an informative error message that users will see when the validation rule is triggered. This message should help users understand why their records cannot be saved.

According to the scenario, you can enter the error message as defined below:

Please enter a unique record with unique data in field.

Choose where you want the error message to appear. You can select options like “Top of Page” and “Field” based on your preference.

Step-7: Click the “Save” button to save the validation rule.

Salesforce Validation Rule ISCLONE Function

Step-8: You can test the validation rule’s functionality after it has been created.

  • Open the “Contact” object, create a new contact with the necessary fields required, and save it.
  • The contact record is successfully created if it is unique. If not, a warning indicating the error will appear, and the record will only be saved once the problem is fixed.

Let’s see an example:

  • Suppose you have created a contact record with all the necessary fields, and you are manually creating a contact same as the already existing contact.
  • The validation rule executes and finds that the record is newly created with the same record but not cloned. Therefore, the record gets created successfully without any error. And sometimes, it gives a warning that a duplicate record is found, but you can ignore it and save it.

With this, we have successfully learned how to use the ISCLONE function in the validation rule in Salesforce Classic.

Conclusion

With this, we have learned about the ISCLONE function in Salesforce. I have explained the syntax, use case, and considerations of the function.

Moreover, I have shown step-by-step implementation of how to use the ISCONE function in validation rules in Salesforce Lightning and Salesforce Classic.

You may like to read the following articles: