salesforce platform developer lesson 2 aj

13
Lesson No. 2 Data Modeling and Management Course Name:SFDC Platform Developer - I Ajay Dubedi Salesforce Expert

Upload: cloudanalogy

Post on 15-Apr-2017

159 views

Category:

Career


0 download

TRANSCRIPT

Page 1: Salesforce Platform developer Lesson 2 AJ

Lesson No. 2 Data Modeling and Management

Course Name:SFDC Platform Developer - I

Ajay DubediSalesforce Expert

Page 2: Salesforce Platform developer Lesson 2 AJ

Agenda

Salesforce CRM Standard Data Model.

Entity Relationships and how to create them.

Real world scenario. How to determine appropriate data model.

Data Modeling and its impact on Apex Development.

Page 3: Salesforce Platform developer Lesson 2 AJ

Salesforce CRM Standard Data Model.

Salesforce CRM have Sales and Service part to it and to support these features we have a default data model already in place. Salesforce as a product have matured in past couple of years and have added several new Objects to its default data model keeping it more generalized and ready to use.

Topic Description: Salesforce CRM’s default Objects and relationships. Understanding the concept of Account, Contact, Opportunity & Product. Default fields and relationships among various objects. Please keep SOAP API Developer Guide handy.

Leads [Campaign Members]

Campaign CaseContacts

Account Opportunity

Pricebook

Conversion

Product1

Product2

Page 4: Salesforce Platform developer Lesson 2 AJ

Topic Description: Lookup, Master-Detail and its various combinations. Describe the capabilities of the various relationship types and the implications of each on record access, user interface (UI), and object-oriented programming.

Lookup : “Creates a relationship that links an object to another object. The relationship field allows users to click on a lookup icon to select a value from a popup list. The other object is the source of the values in the list.” Lookup can be used to create various other relationships to solve real world problems.1. One to One:- A lookup is a relationship from one object to another thus establishing the most basic connection between

various Objects. 2. One to Many:- When you want more than one records of an Object to be related to one record of another Object. 1&2 are

different faces of the same coin(Lookup).3. Self Lookup:- A lookup created on the same object. Used to display hierarchy of an Entity or relationship among the same

Entity. 4. Many to Many Junction Object:- Creation of a new Object and have two lookups fields on it to link many to many

relationships.

Master Detail: Creates a special type of parent-child relationship between this object (the child, or "detail") and another object (the parent, or "master") where:5. The relationship field is required on all detail records.6. The ownership and sharing of a detail record are determined by the master record.7. When a user deletes the master record, all detail records are deleted.8. You can create rollup summary fields on the master record to summarize the detail records.The relationship field allows users to click on a lookup icon to select a value from a popup list. The master object is the source of the values in the list.

Page 5: Salesforce Platform developer Lesson 2 AJ

Topic Description: Describe how to visualize and create entity relationships. Elaborative scenarios representing●Retail [HomeRunner - Lead Generation & Conversion. Data Model Design]●Manufacturing [Black Diamonds - Data Model Design] ●Financial [Goal Advance - Loan Management Redesign]

Once you get a question/requirement try the following steps:-1.List out all the Nouns, verbs and pronouns. Nouns can be identified out as Objects. 2.Identify Objects which fits in Salesforce CRM Data Model. Create new Objects only when needed.3.Find relationship between the Objects discovered. Any hierarchy or dependencies should be noted.

a. LookUp: One to One and One to Many relations can be done via lookup field.b. Junction Object: Many to Many relation should be approached via Junction object solution.c. Master Detail: Dependent relationships between Objects with cascading deletion or mandatory parent should be

established via Master Detail field.4.List out all the properties of those Objects. Properties are the fields in Salesforce storing data.5.Make sure we are keeping the properties with right Object. Their might be some properties which are inter related between 2 objects they can be saved in Junction Objects.

6.Don't create too many fields in a single object. Salesforce have limits for everything.7.List out all the features/functions those Objects are supposed to perform. These will be the buttons, WFs, Validations etc.

Page 6: Salesforce Platform developer Lesson 2 AJ

Example:- DataModel Design

Problem: Home Runner have a web portal and need to configure Salesforce to manage their website visitors. A new or regular visitor of their site does few purchasing and may expect reasonable discounts based on their past purchase.

Problem: Black Diamonds wants its entire business process of

Diamonds buy, processing, brandingand selling to be incorporated in Salesforce it self. Salesforce Products seems to be a Standard Object which fits the scenario but in coming days Company is also planning to invest in Jewellery selling. What Salesforce feature should be used to correctly solve this problem.

Record Types

RT: Diamonds RT: Jewelry

Pricebook

Picklist [Diamonds Lifecycle ]

Leads

Contacts

Account

Opportunity

Lead Conversion

Page 7: Salesforce Platform developer Lesson 2 AJ

Problem

•••

Page 8: Salesforce Platform developer Lesson 2 AJ

●●●●

●●●

Solution

Notes

Contact

Transactions

Address

Q&A Section

Benefit

Opportunity

Page 9: Salesforce Platform developer Lesson 2 AJ

4. Data Modeling and its impact on Apex Development.

Topic Description: Data Model and its impact on Apex. In order to understand. Describe how to programmatically access and utilize the object schema.Describe the capabilities and use cases for formula fields.Describe the capabilities and use cases for roll-up summary fields.

You may face situations in which the Data Model you created will be accessed via several different ways.1.Formula fields | Filters | Templates.2.Apex Class / Trigger. 3.Test class.4.VisualForce pages. 5.Execute Anonymous.6.API callouts

Page 10: Salesforce Platform developer Lesson 2 AJ

Create Lookup & Access them

Owner

Lookup(Account)

Account

Lookup(User)

Account Owner

Opportunity oppRecord = [SELECT Name, Account.Name, Account.Owner.Name FROM Opportunity WHERE Account.Name =‘CloudAnalogy' LIMIT 1];

System.debug('Opportunity Name:-' + oppRecord.Name);System.debug('Account Name:-' + oppRecord.Account.Name);System.debug('Owner Name:-' + oppRecord.Account.Owner.Name);

AccountOpportunity

oppRecord.Account.Owner.Name

Page 11: Salesforce Platform developer Lesson 2 AJ

Create Lookup & Access RelatedLists

Lookup(Account)

Cases

Account

List<Case> caseList = acc.Cases

Account acc = [Select Name, (Select CaseNumber, Subject From Cases) From Account WHERE Name =: ‘CloudAnalogy'];

System.debug('Account Name:-' + acc.Name);for( Case cc : acc.Cases){

System.debug('Case Number:-' + cc.CaseNumber + ' Case Subject' + cc.Subject );}

Case

Page 12: Salesforce Platform developer Lesson 2 AJ

Opportunity|Product|Pricebook

Account

Opportunity

Pricebook

Product1

Product2

Look Up[One to Many]

Look Up[One to Many]

Junction Object [Many to Many]

Junction Object [Many to Many]

Opportunity Line Items

Pricebook Entry

Page 13: Salesforce Platform developer Lesson 2 AJ

Many Thanks !

[email protected] ajay.dubedi +1 (415) 830-3899