Custom objects and fields Salesforce Interview Questions

Preparing for Custom objects and fields Salesforce Interview Questions. Then this article is for you.


Custom objects and fields Salesforce Interview Questions

1. What is difference between standard objects and custom objects?

Standard are objects are predefined by Salesforce like Accounts, Case, Contact etc. Custom object are created by developers based upon application requirements.

2. What are system modifiable fields. Whether these fields can be modified?

Fields like createdby, createddate, modifiedby, modifieddate are system modifiable fields. These fields cann’t be modified. If you want to upload historical data and want to specify values for these fields, then you need to contact salesforce and they will make these fields available for certain duration.

Remember you can specify these fields while doing insert only. You cannot update these fields after insertion. System modifiable fields are available through API’s only not on UI. As a best practice always enable these fields only for initial data migration.

3. True or False: The Created Date can be updated for a record via the API as long as the Modifiable System Fields id turned on.

False. These fields are available for insert and cannot be updated once uploaded.

4. Does salesforce stores the deleted objects and fields?

Yes, salesforce stores the deleted objects and fields for 15 days in recycle bin. You can restore or undelete them from recycle bin.

5. What are external Ids? Does external ids are unique in salesforce?

A field of type external id is a unique id of records from another system. The performance of reports and SOQL is better for fields defined as external ids. Fields of type number, text and email can be set as external id. Each object can have upto three external ids.
External ids are not unique in salesforce. You need select unique and external id checkboxes while creating fields to make external ids unique.

Advantages of External Id:

  • Increase report and API SOQL performance
  • Used with UPSERT to easily integrate apps with other systems

6. What all data type can be used as controlling fields?

Picklist and checkbox. Standard picklist cannot be dependent picklist. Custom fields can be controlling as well as dependent fields.

7. What are encrypted fields?

A field defined as encrypted is not visible to users. Typical usage of encrypted field is for password. Only users with “View Encrypted Data” can view the encrypted fields. Encrypted fields are editable.
Encrypted fields can not be used in where clause in SOQL.

To check encrypted fields, Goto Setup > Security Control > PLatform Security > Encryption Policy > Encrypt Fields

8. What is difference between 15 digit and 18 digit Record id?

In Salesforce, whenever user create any component (Object, field, tab etc…) or record then salesforce will generate an unique id with which user can identify the record or component.
After creating the record, in the URL user can see the id of the record which is of 15 digits length.
15 digit id- It is case sensitive and can be seen in user interface in URLs and Reports
18 digit Id- It is case insensitive. APIs and Apex (SOQL) always return 18 digit Id. Even through apex dataloader, we get 18 digit Id.

First 3 digit of record Id specifies the object to which record belongs. For example account records starts with “001” & contact record start with “003”.

9. What are different types of relationship in salesforce?

Basically there are 2 types of relationship, lookup and master detail.
Other relationships are:

  • Self-relationship- When object is related to itself. For example a case can be related to parent case.
  • Hierarchical relationship- When user has relationship with user. For example we can have manager field in user object which is related to user object only.
  • Many to many relationship- When an object is having master detail relationship with 2 different objects.  The intermediate object is called as junction object. An object is called junction object only if it has master detail relationship with 2 different objects.

10. Can a standard object become child in master detail relationship?

No. Standard objects always remain master.

11. What is difference between lookup and master details?

• Up to 25 allowed per object
• Parent is not a required field
• No impact on security and access
• No impact on deletion
• Can be multiple layers deep
• Lookup field is not required
• Up to 2 allowed per objects.
• Parent field on child is required
• Access to parent determines access to children.
• Deleting parent automatically deletes children(cascade delete)
• Can only be multiple layers deep, the number depends on whether master object is a standard or custom object
• Lookup field on page layout is required.

12. What are roll up summary fields?

Rollup-summary fields are supported in master detail relationship. The parent object can use roll-up summary field type to perform operations of sum, maximum, minimum, count among its children records.

13. What is junction object?

Junction object is an object which has master detail relationship with 2 different objects. Many-to-Many relationships are implemented using two master detail objects. One Junction object is used as the child of the objects between which many-to-many relationship needs to be established.

14. What is difference between self-relationship and hierarchical relationship?

Self-relationship is a lookup relationship to itself. For example a case record can be related to parent case record.
When there is self-relationship exist on user object, then it is called hierarchical relationship. For example, an employee’s manager is also an employee.

15. Can we change already existing lookup relationship between 2 objects to master detail relationship?

System will allow changing relationship to master-detail only if all child records have value specified for parent as in master detail relationship, master is required.
If any of the child value doesn’t have parent value (means look up field is blank), then system will give validation error while changing the data type.
So if it is required to change relationship, them populate all blank values with some parent value and then change it to master detail.

16. Is it possible to change master-detail relationship to lookup relationship?

If the parent object doesn’t have Roll up Summary fields for the child object then we can convert.

17. Is it possible to create the Master – Detail Relationship field for the child object which is having existing records?

No, we cannot create directly. To create first we should create Look up relationship then populate the field value for all the records and then convert the look up relationship to master detail relationship.

18. What will happen if we undelete junction object and normal object from recycle bin?

Master – Detail Relationship data types will be converted to look up relationship data types.
If we undelete any object from recycle bin, then all master detail relationship will be changed to lookup relationship.

19. What will happen if we delete child object in case of look up relationship and master detail relationship?

In case of lookup relationship, we can delete parent object or child object. When parent object will be deleted, the value of lookup relationship field in all child records will become blank.
In case of master-detail relationship, if parent object contain roll up summary, then system will not allow you to delete child object. Also you cannot delete parent object in master detail relationship.

20. Is it possible to filter the records which are coming in look-up window when we click on lookup icon?

Yes, define filter criteria while defining the look up relationship.

Related Salesforce Interview Question:

More Salesforce Interview Question:

Leave a Comment

12 + 2 =