You are currently viewing Salesforce Admin Interview Questions Part 2

Salesforce Admin Interview Questions Part 2

Salesforce Admin Interview Questions – Objects and Relationships

Objects and Relationships

Table of Contents

22. What is an object in salesforce?

Answer:

Objects are database tables that allows us to store data specific to organization in salesforce. Each object contains fields and relationships.

23. What are all the different types of objects available in salesforce.

Answer:

There are two main types of objects in salesforce. They are

  • Standard objects : The objects provided by salesforce is called standard objects. For example Leads, accounts, contacts opportunities, products, campaigns and cases
  • Custom Objects : the objects created by us are called custom objects. Example invoice__c , Employee__c and Payroll__c.
  • Note that all custom object names ends with __c.
  • There are other types like platform events ends with __e and external objects ends with __x

24. What are the different fields or data types available in Salesforce?

Answer:

Auto Number
Checkbox
Currency
Date
Date/Time
Email
Geolocation
Number
Percent
Phone
Picklist
Picklist (multi-select)
Text
Text Area
Text Area (long)
Text Area (Rich)
Text (Encrypted)
Time
URL

25. What are the different data types a standard record name field can have?

Answer:

Standard field record name can have a data type of either auto number or text with a limit of 80 characters.

Standard field name type

26. What is an external ID in salesforce? Which field type supports external IDs?

Answer :

  • An External ID field is a custom field that has an External ID attribute, meaning that it contains a unique record identifier from a system outside of the salesforce.
  • It is used mainly while importing data.
  • Only the following custom field supports External IDs like Text, Number, Email and Auto-Number fields.
ExternalID_text
ExternalID_Picklist

27. What are different relationships available in Salesforce?

Answer:

There are 4 relationships available in Salesforce

  • Master-detail (one to many)
  • Lookup relationship (one to many)
  • Hierarchical Relationship (it is available only for user object)
  • External Lookup relationship
relationship1
relationship2

Apart from those, we can also create few more relationship on salesforce objects.

  • Many to many relationships (Using Junction object)
  • One to one relationship
  • Self relationship
relationship3

28. What is Master-detail relationship?

Answer:

It is a parent-child relationship between two objects in salesforce, and it is a tightly coupled relationship. Ex

  • When a master record is deleted then, its related detail record also gets deleted automatically.
  • The detail record automatically inherits the sharing and security settings of its master record.
  • Master field is mandatory on the detail record page.
  • Up to 2 allowed for an object.
  • The Owner field on the detail object or the child object is not available and it is automatically set as the owner of its related master or parent record.
  • Custom objects which are child in a master-detail relationship cannot have sharing rules, manual sharing, or queues, as these require the Owner field.
  • We can define master-detail relationships between two custom objects or between a standard object and a custom object. However, the standard object cannot be a child object with a custom object.
  • Also, we cannot create a master-detail relationship in which the User or Lead objects are the masters.

29. What is lookup relationship?

Answer:

  • It is a parent-child relations ship between two objects in salesforce, it is loosely coupled relationship which means
  • When we delete parent record child record will not be deleted.
  • Child sharing is not dependent of the parent. It can have its own sharing
  • Parent field is not mandatory on child record page
  • Up to 25 allowed for an object

30. What are many to many relationships?

Answer:

  • We can use master-detail relationships to model the many-to-many relationship between any two objects.
  • A many to many relationship allows each record of one object to be linked to multiple records from another object and vice versa.
  • You can create a many-to-many relationship using junction object.

31. What is a junction object?

Answer :

  • A junction object is a custom object in between the two object for which we have to create a many to many relationships.
  • To create many-to-many relationship, simply create a custom junction object and create two master-detail relationship from the junction object to two object for which you want to create many to many relationship.
junctionobject

32. What is Hierarchical Relationship?

Answer :

It is a special relationship on user object.
It creates a hierarchical lookup relationship between user object.
It allows user to use a lookup field to associate one user with another user record.
Ex: It can be used in a situation when we need to associate a manager to the user where manager is also another user.

33. What is external lookup relationship?

Answer :

  • It is another new type of relationship introduced with salesforce connect.
  • This relationship can link to an external object.
  • Use a lookup relationship when the external data includes a column that identifies related Salesforce records by their 18-character IDs.
  • Use an external lookup relationship when the parent is an external object. Use an indirect lookup relationship when the external data doesn’t include Salesforce record IDs

34. What is one to one relationship?

Answer :

It is used when we want to restrict a user to create only one child record for a parent record. I.e. only one parent will have one child record.

one2one

35. How can we achieve one to one relationship?

Answer :

one to one relationship can be achieved in two ways, one is with configuration and other way is using trigger.

Method1 : Let’s say you want to create one to one relationship between account and contact. Then follow these steps
Step1: Create a custom field on contact object and name it parentID and make it unique.
Step2 : Create a workflow field update on contact and update the parentID field with accountid. If it is first record it will create the child record but if we create the second record then it will fail as the account id is not unique and is repeating for second time
Method 2 : Let’s say you want to create one to one relationship between account and contact then follow these steps
Step 1 : Create a field as a roll up summary field on account object and name it as Contact Count and use the count function while creating the roll up summary.
Step 2 : Create a trigger on contact object and check the roll up summary field which we created i.e. Contact count field and if it’s count is greater than zero the throw and error which says account cannot have more than one contact record.

36. What is self-relationship or self lookup?

Answer :

Self-relationship or self-lookup is the lookup relationship we create on the same object.

Let’s say we create multiple accounts of the same company and we want to treat one account to be the parent Account of rest of the accounts of the same company then we can create a self relationship on the account objects and one account as parent account and rest of the accounts as child accounts.

selfRelationship

37. How do we create relationship fields. Or From which object we create relationship fields?

Answer :

First, identify which is parent object and which is child object for a particular requirement and We should always create relationship fields from child object.

38. Can we create Lookup relationship on an object which already have existing data?

Answer :

Yes, we can.

39. Can we convert lookup relationship to Master detail relationship?

Answer :

Yes, we can convert the lookup relationship to master detail relationship only if all the existing records should be populated with the value in parent field.

40.Can we create Master detail relationship on an object which already have existing data?

Answer :

  • Yes. But it is not straight forward.
  • First, we have to create a lookup relationship then populate the values of parent value on all the record and then convert the relationship to master detail relationship.

41. What happens to the child record when a parent record is deleted?

Answer :

  • In Master-detail relationship, when a parent record is deleted, then child record is automatically deleted. It is called a cascade delete.
  • In lookup relationship, even if the parent record is deleted, child record will not be deleted.

42. What is roll up summary? and Which type of relationship supports roll-up summary?

Answer :

  • Master-detail relationship supports roll-up summary.
  • A roll-up summary field calculates values from related records, such as those in a related list.
  • We can create a roll-up summary field to display a value in a master record based on the values of fields in a detail record.
  • We perform count, sum, minimum value, or maximum value of a field in the detail records.
RollupSummary1

43. A roll-up summary option is disabled in one of the objects. What is the reason?

Answer :

  • Either those objects have to look up a relationship with other objects, or it does not have any relationship with other objects.
  • A roll-up summary field can be created only on a master object in a master-detail relationship
RollupSummary2

44. Can we create a roll-up summary or mimic roll-up summary functionality on a lookup relationship?

Answer :

  • No and Yes.
  • No, we cannot create a roll-up summary on lookup relationship, but yes we can mimic the roll-up summary functionality on lookup using triggers.
  • We may have to write much code to mimic rollup on lookup relationship.
  • There are some free/Paid App Exchange products which mimic roll-up summary on lookup relationship.

45. Can we use a standard object as a child object in master-detail relationship?

Answer :

No. The standard object should always be master in the master-detail relationship.

46. What are lookup filters?

Answer :

  • Lookup filters are used on master detail , look up relationship and hierarchial relationship to filter out the data. It improves user productivity and quality of data. Ex.
  • Restrict the Account Name field on Opportunities to allow only accounts with a record type of Customer , filtering out Competirors and Partners.
  • Restrict the Account Name field on opportunities to allow only active accounts.
Lookup filter

47. What is recycle bin in salesforce?

Answer :

  • As soon as a record is deleted in Salesforce, it will go to recycle bin.
  • If we want to undelete or get back those record, then we can get it from Recycle bin.
  • Deleted records will remain in recycle bin for 15 days after that it will be permanently deleted.
  • Note: There is a limit on recycle bin storage if we bulk deleted records and if it exceeds the recycle bin storage limit, then it is permanently deleted.


Lightning Recycle Bin

RecycleBin1

Classic Recycle Bin

RecycleBin2

This Post Has One Comment

  1. Muriel Paripovich

    This is very helpful; I’ve added to my bookmarks it for future use.

Leave a Reply