Relationships — dependents first

The first lesson we learned in the book was that Force.com is a relational object oriented database. Let us revisit the objects that we saw in the first chapter of the book. In the general library system we have the following relationships:

The object Customer is related to Media through a junction object CustomerMedia. Media object is a master for books and video objects as shown in the following diagram:

Relationships — dependents first

As shown in the following diagram, Fine has a Lookup on Cards:

Relationships — dependents first

Finally, as shown in the following diagram Card has a Master-Detail lookup on Customer:

Relationships — dependents first

When we load data we have to load in the order of dependencies, for example, in the library system the CustomerMedia object is dependent on the Customer and Media object.

Hence, to load the CustomerMedia object we use the following sequence:

  1. Load Customer object data.
  2. Load Media object data.
  3. Finally load the CustomerMedia object data.

The rule of thumb when uploading the data is that every dependent object data should be loaded first. As the CustomerMedia object had two dependencies, one on Customer object and another on Media object, we loaded both the data first.

Modifying system fields

When we are loading legacy data into the Salesforce system during migration it is sometimes essential to change the Created Date, Last Modified Date, Last Modified by, and Created by entries. Normally, when we load data into the system, the dates are not modifiable and are system time stamped.

However, Salesforce.com provides us with the facility for modifying the auditing fields only once during the first insert. This is helpful in migrating legacy data and preserving history.

To enable this feature we need to contact Salesforce customer support.

Features of modifiable system fields

Some of the important features of modifiable system fields are as follows:

  • The fields can be modified only once in the lifetime of the initial insert
  • They are accessible through API, that is, the data loader
  • All custom objects can have modifiable system fields, however, not all standard objects can have modifiable fields
  • Account, opportunity, contact, lead, case, task, and event can have modifiable fields
  • The fields are read-only for existing records
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset