Salesforce form template for ResearchPark
The instruction is for MacOS.
-
Install Homebrew
-
Install
Atom
brew cask install atom
-
Install MavensMate Desktop
-
Install
MavensMate-Atom
apm install MavensMate-Atom
-
Login into salesforce, goto
Setup
-
Goto
Deploy -> Sandboxes
on the left explorer. ClickNew Sanebox
to create a new sandbox. SelectDeveloper
license and clickNext
. -
After your sandbox created, select
New Project
inMavinsMate Desktop
, and choose typeSandbox
. It allows to log in your project by web auth and you need the auth code from your manager. -
After logging in, you're ready for development.
To get your familiar with the salesforce, here are some basic components.
- Object (Custom Object)
- Object is the most important component in salesforce to store any information you collected form the users. It's like the database at the end.
- Goto
Create -> Objects
on the left explorer to view all the objects and to create new type of object.
- Visualforce Page / Visualforce Component
- Visualforce Page or Component performs ui.
- You can write html / css / js or apex component in it.
- Here's an intruduction to visualforce
- Apex Classes
- Apex Classes is the controller part in the mvc structure.
- It could connect to Visualforce Page and perform some actions.
This repository provide you a basic form template. It's built on several open source libraries such as jQuery and BootStarp. I suggest to editing on this base since it can provide many general well-designed modules and there is no need to rewrite them.
The form is consisted by the following parts:
- Custom Object: Information to be collected and prompts.
- Visualforce Page: UI
- Apex Classes: Verify and save information.
You have to complete at least these three parts, if you needs more customization such as email notification or SPA, please follow the rest part of the document.
Make sure you are working in sandboxes
The first step is to define a custom object which could save the information you wish to collected. It could also provide some additional prompt text.
- Goto
Create -> Objects
underSetup
tab. Click onNew Custom Object
to create a new object. - Follow the instruction and the example, type in the name and label. You do not need to modify any fields other than the required one. Click
Save
. - Create or modified the fields under the
Custom Fields & Relationships
tab. - There're two fields important and need to be remembered.
API Name
will be used in the Apex Classes, andHelp Text
will be displayed on the webpage.
- Create an Apex Classes, copy and paste the
Apex_Classes_Template.cls
. - Replace all
CUSTOM_OBJECT_API_NAME
with the API Name of the object you just created. - You need to fill the
fieldName
in Apex Classes so the backend could pass the reference to the client. For example, for the followingfieldName
'---', 'h:Referral Partner\'s Contact Information', 'p:All requests for small business assistant services must come from referrals from partners including; incubators, SBDC, PTAC offices, ITCs, University of Illinois Extension Offices, or higher education entrepreneurial programs.', 'Referring_Partner_s_Name_Organization__c', 'Referring_Partner_s_Phone__c', 'Referring_Partner_s_Email__c',
---
will be an horizontal line in the page,h:xxx
will be a header with bold and larger font,p:xxx
will be the prompt text, and other fields s.t.Referring_Partner_s_Phone__c
should be the field API name that you defined before.
- Create a VisualForce Page, copy and past the
VisualForce_Page_Template.page
. - Replace all
CUSTOM_OBJECT_API_NAME
with the API Name of the object you just created. - The title and the introduction section can be customized. Replace the following section to modify them.
__FORM_TITLE__
__ADDITIONAL_SECTION__
__ADDITIONAL_INFORMATION__
Salesforce uses a mechanism called "Inbound / Outbound"
- Log into your sandbox. Goto
Deploy -> Outbound Change Sets
. - Create a new change set, add the component you wish to apply to master. And add its dependencies.
- Upload the change set.
TODO
To send an email notification to either the user who submitted the form or the manager who will review the requests,
- Create email template. Goto
Communication Templates -> Email Templates
, and create a new template with the content you wish to send to the user or the manager. - Create workflow. Goto
Workflow & Approvals -> Email Alerts
, and create a new action, select the template you just created and the recipients - Create rule. Goto
Workflow & Approvals -> Workflow Rules
, and create a new rule. Select the related object and choose criteria, then check the related action. - Finally deploy to production, then active it.
TODO