Salesforce Data structure

Salesforce is a CRM application that is build upon a set of data. These data may refer to customers, but is is possible to create your own data structures.

These data structures have two types of field that are used to create the relation ships.

The first type can be seen in object (Boek__c) that I created:

Look at Titel__c that has a data type External ID. That is something like a primary key that is used to uniquely identify a record. This then implies that we could load the Titel__c fields with unique data that we may use to find a particular record.

We also have another table (Hoofdstuk__c) that has next fields:

Look at the field Boek__c that acts a foreign key to table Boek__c. The data type is called Master-Detail that indicates that this field is used as a linkage to another table.

If we look at the details of this field, we notice that relationship is called “Hoofdstukken”:

We load these tables by first loading the master tables. In this case, the master table is Boek__c that contains these data:

Data like “Winnetou, Old Shatterhand etc are entered by the user. The ID is generated by the Salesforce system, but is important to know. We must load the detail records with these ID data. As an example, look at the load file for Hoofdstuk__c:

"BOEK__C","INHOUD__C"
"a003X0000162hobQAA","1. Het pistool"
"a003X0000162hobQAA","2. Het geweer"
"a003X0000162hocQAA","1. De zuster"

Boek__c acted as the master-detail data type in Hoofdstuk__c. We must use the Ids from Boek__c.Id to load these. This implies that such Ids must be retrieved and subsequently be used as entry values for Boek__c in the Hoofdstuk__c table.

We can then retrieve full information within the developper console with this query:

select Boek__c.Id, Boek__c.Titel__C,(select Hoofdstuk__c.Inhoud__c from Hoofdstukken__r) from Boek__c

Note that we use the name from the relationship (“Hoofdstukken”) to retrieve the values from the detail table. The result then provides:

The values from the master table are provided in plain text, whereas the values from the detail tables are provided as json texts.

Door tom