Salesforce Cloud Database
By Ryan Melvin
Outline Introduction Advantages of Cloud Computing Major Techniques System Architecture System Design Implementation What I learned Demo
Introduction What is Salesforce? - Salesforce is a cloud-computing infrastructure
that enables businesses and users to use software and applications over the internet
- Rather than running software and applications on local machines, everything is accessed over the internet through the Cloud-based vendor’s website (e.g., salesforce.com)
- With cloud computing, computing is delivered as a service rather than as a product.
Advantages of Cloud Computing
Software does not have to be installed and maintained
All upgrades are automatic Servers are not needed Manual Backups are not needed Software and hardware is maintained by the
Cloud-based vendor (e.g., Salesforce.com) You only pay for the resources you use
Major Techniques Transaction Support:
Transaction support is built into Salesforce, so it does not need to be implemented by the DBA; changes to the database are only committed when the the apex code in the controller and on the visualforce page have finished executing. Either all of the changes are made or no changes are made to the database.
Salesforce also provides constructs for manually creating savepoints, and manually rolling back the state of the database to its state at the time the savepoint is created
Savepoint sp = Database.setSavepoint();
Database.rollback(sp);
Security
- Salesforce provides extensive security measures
- Every user on Salesforce belongs to a certain profile (regular user, staff member, etc)
- Permissions are controlled by setting access rights for each profile (what tables can be read/modified, etc)
Permissions for Staff members
Rather than creating views to restrict access to fields, access to fields can be directly set for each profile
Field Access
System Architecture Salesforce uses the MVC(Model-View-
Controller) architecture Database tables are models Visualforce pages are the user interface and
view Apex classes are the controllers
The controller is the “middle-man” between the model (database) and view (Visualforce page)
The controller (an Apex class) receives user input submitted from the view (Visualforce page), which invokes actions on the model (database) (e.g. retrieve records)
After the controller retrieves the data from the model (database), it then communicates the data with the view, where it is displayed
System Design Three levels of users: users, staff, and
management
Users can: Buy products from the storefront website Leave feedback Request an account by filling out the registration
form (A staff member must create the account for them)
Staff can:
Process customer orders Add/edit/remove merchandise (e.g., change
quantity, etc) View all staff information except salary View all departments View customer feedback Process requests for accounts from users Act as users and purchase products from the
storefront
Management can:
Add/edit/remove staff members (e.g. hire/fire) Add/edit/remove departments View all staff information (including salary) Do everything staff and users can do
Tables for Staff management:
Staff(fields: Staff ID (PK), first name, last name, department ID (FK), age, sex, DOB, position, salary)
Department(Fields: department ID (PK), department name, department phone number)
Tables for Warehouse:
Merchandise(fields: Merchandise Name(PK), Description, Price, Total Inventory)
Invoice Statement(fields: invoice number(PK), status, invoice value)
Line Item(fields: item number (PK), Invoice Statement (PK, FK), Merchandise (FK), Unit Price, Units Sold, Value)
Tables for User Management:
PaymentInformation (fields: email(PK), first name, last name, telephone number, billing address, shipping address, credit card number, City, State, Zip Code, Country)
Feedback(fields: email(PK), comments(PK), Date)
Registrationrequest(fields: email(PK), First Name, Last Name, Community Nickname)
ImplementationExample: The model, view, and controller
for displaying the merchandise on the storefront page
The Model
The Controller
The Model
The View
What I learned How to create database tables, Apex classes
(controllers), and Visualforce pages More about the MVC model and how it is applied
on the Salesforce Cloud How to create profiles (user groups) How to set permission rights and field access on
Salesforce
What I learned (Cont’d) How to read/insert/update/delete database
records using tabs within applications Some of the Apex programming language How to build a storefront on the Salesforce cloud The benefits of using a cloud database
Demo
Creating a Table and a Field
Adding a new merchandise product
Making A Purchase on the Storefront
Top Related