Thursday, May 12, 2016

Salesforce Interview Questions-Validation Rules

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.


29 comments:

  1. This content creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.

    Salesforce Training in Chennai

    ReplyDelete
  2. Sorry to be frank and straignt forward, I have been attending interviews from 3 months, None of them asked like this STRAIGHT forward questions, these are very good for those TRAINERS but Not at all for Real time interviews.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. For Ques#9 conditions should be Priorvalue(total_count__c) >total_count__c

    ReplyDelete
    Replies
    1. I think NO...
      and Author made no Mistake...

      Delete
    2. This comment has been removed by the author.

      Delete
  5. Validation rule can be bypassed by selecting "ignore validation" in user detail page.The provided answer is not correct.

    ReplyDelete
    Replies
    1. Please explain how this is possible. Thanks.

      Delete
  6. This is brilliant. Kudos!

    ReplyDelete
  7. In 9th question this is the correct logic:
    "PRIORVALUE( counting__c ) > counting__c"
    I mean use > symbol.if you have used < , then you'll not be able to retrive the deleted child back from the recycle bin.

    ReplyDelete
  8. Can we bypass validation Rules?
    Yes -using Permission Set we can bypass validation Rules

    ReplyDelete
  9. Really helpful content. These are all repetitive and very important questions which interviewers asks all the time. Thank you!!

    ReplyDelete
  10. Thanks, this is generally helpful.
    salesforce cpq training
    Visit us: salesforce cpq course

    ReplyDelete
  11. Hot And Sexy Independent Model Escort Service In Delhi Unlimited Enjoy Genuine 100% Profiles And Trusted Door Step Call Girls Feel Free To Call Us 24/7Hours Opens Thanks..
    Call girls in Noida
    Noida Call Girls
    Escorts in Noida
    Noida Escorts

    ReplyDelete
  12. Do you Need Instant Loan from $2,000 to $50,000,000.00 with no collateral required and receive a no obligation loan approval.We welcome the opportunity to show you how effective we are at helping our clients obtain the money they need to succeed. Our professional staff is available for a Free Consultation.At Patiala legitimate company Pvt , contact us now 2% interest rate, both long and short term cash reply to us (Whats App) number: +919394133968 patialalegitimate515@gmail.com 
    Mr Jeffery

    ReplyDelete
  13. Data Validation Security System
    Data Validation Security System - Pharmacies: Monitoring and recording of the environmental conditions of medical supplies storage Captemp.com.

    ReplyDelete
  14. Admin please remove the unwanted comments

    ReplyDelete
  15. thank you sir i liked your post very much can you give me any tip so that i can start my new blog i try very hard to make a good block but i can not make so sir please help me


    Gurgaon Sector 74 Service Girls
    Gurgaon Sector 76 Service Girls
    Gurgaon Sector 80 Service Girls
    Gurgaon Sector 81 Service Girls
    Gurgaon Sector 82 Service Girls
    Gurgaon Sector 83 Hot Service Girls

    ReplyDelete
  16. kya aap bhi chhote penis se pareshan hain toh aap fr aap market se penis size badhane ki dava oil use karke bada aur mota kare skte hain aise karne se aap ka ling bhi bada hoga aur uska size mota hoga aur sath hi sath aapki sex karni ki timing bhi badegi

    ReplyDelete
  17. The principal region is in choosing the lawyer and the subsequent region is botches made in the wake of choosing the lawyer.
    Brain Injury Attorneys

    ReplyDelete
  18. A few lawyers have expounded broadly on the law. https://frouharlaw.com/

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. agar aap bhee apni bibi or girlfriend ko santusht nahi kar paate hai aur jaldi discharge ho jaate hain to Timing Badhane Ke Liye Spray ka use kar sakte hain.

    ReplyDelete
  21. You’ve shared some excellent material. I’m grateful for this post

    ReplyDelete
  22. Discover the impeccable world of luxury dresses by Ammara Khan. Elevate your fashion game with our exquisite collection of Pakistani Luxury Formals and indulge in the finest luxury clothes that Pakistan has to offer.

    ReplyDelete