Quantcast
Wednesday , December 13 2017
Home / Admin / Data Model and Management

Data Model and Management

Data Model and Management

Data Model

 

A data model is a way to represent the tables in the database which makes sense to humans, they help in understanding the relationship between different objects and Salesforce provides a very intuitive way to model the database.

In the database a table is equivalent to an object, fields of the object are referred as a column of the table and a row of this table is known as a record. The data model is a collection of these objects and field in an app.

There are many types of objects supported by Salesforce like standard object, custom object, external objects, Big Objects and Platform events. We are going to stick with standard and custom object for now.

Standard objects are the objects which are already created by Salesforce and are useful when it comes to the core of the Salesforce i.e. CRM, all the objects which are common and relevant to CRM is already present in Salesforce, for e.g. Account, Lead, Contact, Opportunity etc.

Custom Objects are the objects which are created if the standard out of the box objects is not able to satisfy a business need or requirement. A custom object could be anything like a student object, property object, room object etc.

Objects are basically a blueprint of a type of information, i.e. each record will have more or less exactly the same information if not less. Salesforce not only provides the intuitive way of creating an object it also creates few pages for us with writing a single line of code i.e. detail page and other page layout for the User interface.

Let’s find out how to create a custom Object (steps for Salesforce Classic):

  1. Login to your org and go to setup
  2. On left-hand side in the quick find box type object and you will see the left-hand sidebar will update itself and will show result relevant to our entered text, click on the objects under create the menu.

Data Model Create Object

3. It will take you to a screen where you will list all the custom sObject and some information about them as well, you will find a button in the middle of the screen New Custom Object, click on this button.

Data model create new Object

4. This will bring you to the page where you define your new objects like its label, Plural label, API Name (Object name), its description what should be the type of the record name i.e. text or auto number

Then some other properties like Allow reports, activities, track field history deployment status, search status and feature of adding notes and attachment

Data Model create object part 1

Data Model Create object part 2

5. Once you have completed filing in the information, click on save and if you don’t see any error message then you have successfully created an object and would be directed to the object detail page.

And that is how you create an object, the properties you define on the object detail page will mold the behavior of your object in the Salesforce Platform.

Now since we have created a bigger container to hold information (Object), let’s know about how many fields and types of field are there to store relevant information.

There are broadly four types of field:

  1. Identity – it is a unique identifier throughout the Salesforce, it is a case sensitive field and is automatically generated for every record and is 15/18 character long.
  2. System – these are read only field and provide information about a record like when it was created or edited and by whom.
  3. Name – This is the only mandatory field need to be defined while creating a custom object it can be a text field or an auto number
  4. Custom – any field other than the one mentioned above are custom fields and have a custom data type associated to it.

There are many types of data type to indicate what kind of information a field is holding, few of the data types are – data/datetime, checkbox, picklist, currency etc. Following are the steps to create a custom field on account object (Salesforce Classic).

  1. Go to object Detail page of account object, type account In quick find box and click on field.     Data model create field
  2. Find Account custom fields and relationship section and click on the new button, it will take you to another screen, where you would be asked to select the data type of the field or if it is a relationship field or a special field like auto number formula of Roll-up SummaryData Model Create FieldData Model Create Field
  3. After selecting the data type, click next and then you have to enter more details of the field like its Label, API name, description, help text, whether it is required or not and a place to put default value. These are the common fields available for almost all the data type but screen changes itself according to the data type selected by user.Data Model Create Field
  4. After providing the necessary details click on next and this screen will take you to the field level security if you want change the default access of the field to specific profile.Data Model Create Field
  5. After specifying the field level security, you are asked on which layout you want to place the newly created field, if you do not have more than one then the default layout of the object appears as selected choice.Data Model Create Field
  6. Click on save and the newly created field can now be found on the page layout selected

And that is how you create a field.

Some tips to implement before you start customizing your org,

  1. Naming convention should be practiced to avoid ambiguity/or lazy naming for e.g. for a custom object to track equipment you named it property2, this could lead to confusion in the org be thoughtful
  2. Always include description or help text, so that it gets clear to the user what they are dealing with
  3. Make a field required if it is necessary, the field which are important to a particular object i.e. price of an equipment, then make price field required i.e. it must be filled before saving a record.

Data model is incomplete without defining any relationship between two objects, so now let’s dive deep into the object relationship

Object relationships

 

What are Object’s Relationships and how do they affect the data integrity in the salesforce? How many types of object relationship does salesforce Support? These are the type of question arises in one’s mind when we talk about Object relationship in salesforce.

To being with salesforce supports two type of relationships namely lookup and Master Detail. Lookup up relation is basically linking two objects and one object can access fields of other object through this relationship, where as master detail relationship is a bit more tightly linked to each other. In this one object is master and other is its detail or I should say one is parent and other is its child object. In MD relationship some behavior of child objects are governed by the master object.

Lookup relationship can be on- to-one or one-to-many, when two objects are linked as lookup relationship, means that they are sometime related and sometime not for example a contact object can be associated to account but it can be just a contact in itself, but this is not the case in Master Detail relationship. Master detail relationship does not work as standalone and the child object has to specify its master or parent object before it can be stored in database.

The link between master detail is such that when the parent record is deleted then the child record also gets deleted, but this not the case for lookup when one of the look up record is deleted only the field referring to the linked objects get deleted.

There is one more relationship available but only for User object, it is known as hierarchical relationship, where a hierarchy is established a management chain between the user objects.

Steps to create a relationship field is same for both look up and master detail with few minor changes, lets create a look up first.

  1. Go to setup, type objects in quick find menu and click on objects.
  2. Then click on the desired object and go to the custom field and relationship section and click on new, on the object detail page.
  3. Select look up field type and click next.Data Model Create Field
  4. Select the object you want to make a link.Data Model Create Field
    1. Enter all the required field’s detail and click next it will then take you to the object permission page and then to the layout page

    For Master detail relationship select MD on step 3 and follow the remaining steps as above.

Data Model Create Field

Visualizing the object’s relationships

 

You can see your data model in action by using the salesforce very own schema builder, this tool helps you visualize your data and their relationship with each other. To reach schema builder go to setup and type schema in the quick find box and click on schema builder it will take you to a screen similar to thisData model schema builder

On this canvas, object can be dragged and dropped and it will not change their relationship, this way we can easily visualize the relationship. Schema builder is not only used to visualize data but also to create new elements like Objects and fields, which can be created directly in schema builder.

To create an object, select element tab on the left hand side bar and drag the Object element to the canvas and enter the required information and click save and that is it the new object is created, similarly, to create a field from the element tab select the required field and drag n drop it on the desired object, enter the respective details and click save and this is it, you have created a custom field on the selected object.

 

Data Management

 

Salesforce and any other CRM platform is data driven and therefore it’s a platform’s responsibility to provide simple user friendly way of managing this data, whether it Is data import or export. To manage Data in salesforce there various ways some are built in feature of Salesforce like Data import wizard and data export utility then there are many 3rd party applications like data loader (desk top application), Dataloader.io, Command line interface of Data loader (automatable).

Salesforce offers two main method of importing data.

  1. Data import wizard: used when the import size is limited to 50000 records, selected standard objects and all of custom object. It has simple interface for configuration parameter and field mapping for matching fields in the file.
  2. Data Loader: it’s a client application and can load records up to 5 million, can upload data in any object type and file type. Possible to automate data loading task and field mapping and other configuration can be specified in a separate configuration file.

But importing data is not as simple as it seems like, we have sometime pre import and post import task and similarly pre and post export tasks, like validating the import. Follow these steps to prepare data for importing.

  1. Create an export file
  2. Clean it up for accurate and efficient data import, look for duplicate record and remove if found any, delete unwanted information and check for spelling.
  3. Compare the fields in file with salesforce and match appropriately
  4. Make configuration changes required at salesforce end and

Let us now start using Data import wizard:

  1. To open the wizard, go to setup and type data import wizard in quick find box and click on launch wizard.         Data import wizard launch
  2. After clicking on the button you would be directed to home screen of the wizard here you select which objects you are going to work with.Import Wizard Select Object
  3. Once you select the type of object to work with, the wizard will ask what to do next i.e. insert, update or both.import wizard sobject selected
  4. After selecting the operation you would be asked for a matching criteria if you want to update a record and other operations like to initiating trigger or not, assigning the records to campaign if that is relevant to the importation of the records.import wizard after upsert operation
  5. Next is to upload the file containing the records, this can be of four formats supported by salesforce at the moment, i.e. CSV, Outlook CSV, ACT CSV and Gmail CSV.import wizard file format supported
  6. Once the file is uploaded click next, most of the field will get automatically mapped wit field in salesforce for the remaining fields, you will be taken to the page where you will map the unmapped fields. Do the manual mapping and proceed by clicking on next.Import Wizard Field Mapping
  7. Now you will be taken to the Review screen and the wizard will now ask to proceed with the import.import wizard review screen
  8.  click of start import you would be directed to the detail page of the bulk job we just started and we will get a job Id and other information related to the bulk data load job details.import wizard bulk job detail page

    Next Come Data Export:

    For this purpose again salesforce has provided the native functionality that can be found on the platform and we have 3rd party app like data loader to perform export task for us. Here we will discuss the export wizard only.

    The native Data export let’s you export all of your data in the salesforce, to go export wizard type data export in quick find box and click on Data Export.

    Once the data export home screen is reached there are two option one is export now which will straight away start the exporting operation and other is schedule export which automates this process and make it a recurring event.launch data export

    Let’s click on the export now button, this will take you to the screen where you can select the export service, here you get an option to select all data or some selected objects. There is also an option to select image document and attachments and content versions.Data Export Home Screen

    Once the desired objects are selected click on start export, you will then be redirected to the detail page of the export and you will receive an email with the link to the page where we can download the exported data.data export after export screen

     

    Once the export procedure is completed it will add a link to the exported file. The file is in zip format and can be downloaded to the local machine from there. The file is present at this location for a limited time i.e. 48 hours, download the file before this time or you have to repeat this procedure again. Download as shown below.data export exported file

    Similarly we can schedule the data export, from the home screen of data export click on schedule data export and this will take you to the screen similar to data export object selection screen, the only difference is the option to select the frequency of this export, here you can select day of the month and the duration of this service, as shown belowdata export schedule data export

     

    One can use this feature to download the data or export from one org and then automatically import this to other org using the Command line Data loader.

     

    That is it from this post, reach out to me if you have any concern, Happy coding.

About Sumit Datta

Sumit Datta

I am a 3x Certified Salesforce developer with overall 4.5 years of IT experience and 2.5 years of Implementation experience in Salesforce. I am here to share my knowledge and help Beginners in Salesforce to understand the concepts of Apex, Visualforce and Salesforce Configuration.

Check Also

Dreamforce

Dreamforce Global Gathering 2017, my experience and why one should not miss this event.

Dreamforce Global Gathering 2017, my experience and why one should not miss this event. First …

Salesforce AppBuilder Certification

Salesforce AppBuilder Certification Mock Exam 1

Want to test your preparation for the Salesforce AppBuilder Certification?   Salesforce AppBuilder Certification mock Exam …

Salesforce Platform Developer 1 Certification

Salesforce Platform Developer 1 Certification Mock Exam 2

Want to test your preparation for the Salesforce Platform Developer 1 Certification? Then go through …

Advanced Formula, Salesforce Platform unleashed!!!

Advanced Formulas Introduction to formula fields and Advanced Formulas Formula Field is a powerful capability …

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *