Do you have a .net/sql background and you are skilling on SalesForce Dev too? The easy way is to read carefully and practice on the workbook you can find here and to give a reading to this post 8-P.
After reading it, I found there are some fixed point that is good to take in mind and organize; consider this post as an extra of the workbox to help developer coming from .Net/Java backgrounds.
The SF platform is built with the MVC pattern in mind so to develop your application on the cloud you have to consider 3 pillars:
- A database to model the information => the Model
- Business logic and workflow => the Controller
- A user interface to expose data and functionality => the View
A custom object is what you know to be a table in the db, so first thing to do is a mapping of the entities in our business domain with the custom object in our application (the Merchandise of the workbox)
Why? because behind the scene all the CRUD operation are implemented by the platform, so what is necessary is just define the fields that give a meaning/context to the custom object and any relation between them…
This remember us, the ORM approach where business objects are mapped by the framework automatically, the ‘Context’ exposes the functionality to persist any changes done in the UI, without writing explicit query
An Application is a collection of Tabs, each Tab render the UI to CRUD the records (rows) of the custom object (table), so an application manages the record int the objects that are exposed in the collection of Tabs itself.
In SQL a table has a PK (one or more column) and FK to refer others tables; in SF the language is a bit different
The Identity column is implemented with AutoNumber, the referential integrity is achieved defining a new custom field of type relationship Master Detail, where you define the Related field to the foreign object… the other are a kind of sql types: email, number, date … as we can expect. The computed fields are implemented using the Formula Data Type, where you define how the field is calculated on the fly (which fields and operation to use); finally the Roll-Up is used when you want to aggregate other field values.
Any sort of sql check constraint is done with Validation Rules, be careful becuase the validation rule is what fires the error msg, usually in asp.net you write the opposite, the constraint to be respected, in SF you write the formula to violate the rule and the related error msg, this will be used for validation in the CRUD operation in th UI.
To smartly handle the various cases for the validation rule, SF exposed some functions to use in the formula Ex ISNEW() to know is the record is a new one or an update…
Next post will focus on the logic, Workflow and Approval processes, all implemented without any single line code…