Validation Rules Salesforce Interview Question

Table of Contents

  1. Validation Rules Salesforce Interview Question
    1. 1. What are validation rules?
    2. 2. Can we avoid deletion of records through validation rules?
    3. 3. Can we bypass validation Rules?
    4. 4. Is it possible to fire validation only for records which is being getting updated not to newly inserted records?
    5. 5. Is there is any way through which validation rule is bypassed while doing upload through data loader  but not when user is creating record from user interface?
    6. 6. What is the difference between ISBLANK() AND ISNULL()?
    7. 7. What are cross object formula fields?
    8. 8. What are different ways to make field required in salesforce?
    9. 9. Admin wants to avoid the deletion of child records in master detail relationship. Is it possible to achieve this using point and click functionality?

Preparing for Validation Rules Salesforce Interview Questions. Then this article is for you.

Validation Rules Salesforce Interview Question

1. What are validation rules?

Validation rule contains an error condition and error message. If evaluation of error condition results in true value, record is not saved, and the error message is generated. Validation rules can be attached to fields. They are executed when a record is created or updated.

2. Can we avoid deletion of records through validation rules?

No. Validation rules fire in insert and update operation.

3. Can we bypass validation Rules?

Validation rules can never be bypassed. If we have upload records and need to bypass validation, then deactivate validation rule and upload records. After upload, again activate validation rule.

4. Is it possible to fire validation only for records which is being getting updated not to newly inserted records?

Yes, We can use ISNEW() function which will return true whenever new record is getting created in validation rule. We can use this function and check our criteria only if ISNEW() function is returning false(means record is being updated).

5. Is there is any way through which validation rule is bypassed while doing upload through data loader but not when user is creating record from user interface?

Yes. Create a checkbox field as API upload and make this field hidden in page layout. Create a validation rule and in evaluation criteria first check if checkbox is false and then check other validation criteria.
Whenever user upload record through data loader, specify value for this checkbox as true in .csv file and then upload it to salesforce. While upload, validation rule will fire and will find checkbox value as true so it will not check other criteria and system will allow to upload records.

6. What is the difference between ISBLANK() AND ISNULL()?

ISNULL() works only for number data type fieds, if we don’t populate with value for number fields it will return true.
ISNULL() won’t support TEXT data type fields because text fields never become null.
ISBLANK() supports both number as well as text data types.

7. What are cross object formula fields?

Cross-object formulae span two or more objects by referencing merge fields. By using this you can refer parent fields from child record.

8. What are different ways to make field required in salesforce?

  1. While field creation, specify required field as true.
  2. Through page layouts
  3. Validation rule
  4. Apex trigger

9. Admin wants to avoid the deletion of child records in master detail relationship. Is it possible to achieve this using point and click functionality?

Yes. First create a roll up summary field on parent which calculates the total count of child records. Now write a validation rule on parent object which checks if previous value of total count is less than new value. If yes, then display error message.
Suppose field name is total_count__c in parent object then validation rule criteria will be:
Priorvalue(total_count__c) <total_count__c
When we delete the child record then roll up summary field value will get reduced by 1. System will update the parent record roll up summary field which will fire the validation rule and avoid user from deleting child record.

More Salesforce Interview Question:

Related Salesforce Interview Question:

Leave a Comment

5 × two =