This post covers the essential steps you need to follow to complete your first SalesForce application, in the “cloud.”
SalesForce.com best know for its CRM also provides a big and growing framework for cloud computing and applications. With Force.com you can build apps faster, you can create applications without the concern of buying hardware or installing software.
Starting at the Beginning
First of all you will need to register for a Salesforce.com developer account. Once you have a valid username and password, login into SalesForce.com.
For this exercise you will create simple Warehouse application with the following objects:
- Product
- Fields: Name, Description, Price, Stock quantity
- Line Item
- Fields :Invoice #, Product #, Units sold, Total value
- Invoice
- Fields: Description, Invoice Value, Invoice Status
In the Product object you will specify the Name, Description, Price and Total Inventory (stock) of the product. Creating an object automatically creates a table with each field as a column in the table. You can query that object using SOQL.
In the LineItem in which you will specify the related Invoice Number, number of Units Sold and the Total amount.
Finally, in the Invoice object in which you will specify a Description as well as the invoice Value and Status.
Creating the Objects
To create the objects go to Your user Name, located in the upper-right corner of the Main page. Select Setup from the list.
The Personal Setup dialog will appear. Click on Create and click on Objects.
In the next dialog click on the New Custom Object button.
In the next dialog you are going to set the object properties.
Fill the property fields with the following information,
Label: Product
Plural Label: Products
Gender: Masculine
Object Name: Product (this is the name that will be used via API)
Record Name: Product Name
Data Type: Text
Creating Tabs
Check the option to Launch New Custom Tab Wizard after saving this custom object.
Then click the Save button.
You will see the next dialog, select the Tab Style you prefer and click Next.
Click Next again and then click on Save.
Now you will see the object definition detail. You need to create the custom field of that object. Click on New under Custom Fields & Relationships.
You will now create the Description Field so select text in the next dialog. Click on Next.
Input the information as shown in the next picture:
Click next again then click on Save.
Create a new Custom field, Price, and fill it in with the following information,
Data type: Number
Label: Price
Length: 18
Field Name: Price
Create a new Custom field, Total Inventory.
Data type: Number
Label: Total Inventory
Length: 18
Field Name: Total_Inventory
Thatís all you have to do on that object. Now you have to create the following objects following the same procedure.
Create the Line Item & Invoice Objects
Now you have to create the Line Item object.
Label: Line Item
Plural Label : Line Items
Gender: Masculine
Object Name: Line_Item (this is the name that will be used via API)
Record Name: Line Item Name
Data Type: Text
Create the Invoice object
Label: Invoice
Plural Label :Invoices
Gender: Masculine
Object Name: Invoice (this is the name that will be used via API)
Record Name: Invoice Name
Data Type: Auto Number
Display Format: INV-{0} (this means that every invoice instance will have the INV
prefix followed by an auto-increment number)
Creating Custom Fields
Now you will create some custom fields for the LineItem object and the Invoice object.
Go to objects and click on the Label Line Item.
Create a new Custom field, Invoice.
Data type: Master-Detail
Related To: Invoice
Label: Invoice
Field Name: Invoice
Child Relationship Name: Line_Items
Create a new Custom field, Product.
Data type: Master-Detail
Related To: Product
Label: Product
Field Name: Product
Child Relationship Name: Line_Items
Create a new Custom field, Units Sold.
Data type: Number
Label: Units Sold
Length: 18
Field Name: Units_Sold
Create a new Custom field, Unit Price.
Data type: Number
Label: Unit p
rice
Length: 18
Field Name: Unit_Price
Create a new Custom field, Total Value.
Data type: Formula
Label: Total Value
Field Name: Total_Value
Formula Return Type: Number
Total Value (number) = Units_Sold__c * Unit_Price__c
Now you will add the object fields for Invoice
Go to objects and click on the Label Invoice.
Create a new Custom field, Description.
Data type: Text
Label: Description
Length: 255
Field Name: Description
Create a new Custom field, Invoice Status.
Data type: Picklist
Label: Invoice Status
In the text area type:
New
Open
Submitted
Field Name: Invoice_Status
Create a new Custom field, Total Invoice
Data type: Roll-up Summary
Summarized Object: Line Items
Select Roll-Up Type: SUM
Field to Aggregate: Total Value
Note: this roll-up summary will fetch all Line Items and SUM the total Value of the invoice.
Congratulations! You have created your first SalesForce.com application.
Take It for a Ride
Now you will add three tabs to to access the application you have just created.
- Go to the Home page
- Click on the plus (+) link
- Click on Customize My Tabs
- Select the objects you have just created and save.
- Note that now you are now able to create Products, Line Items and Invoices.
- Try creating a new product.
- Input the required fields and click Save.
- Once it’s saved, you will see the product you just created.
Now you can create more instances, they are fully functional now.