To learn more about
Force.com and to access a rich set of resources, visit Developer Force at developer.force.com
.
Workbook2009.pdf
1-4章要点总结
数据库ER图
如下:
Tutorial #1: Creating a Warehouse Application
Step 1: Create a Merchandise Custom Object
- So you'll begin by creating a data object
that keeps track of all the elements of a particular merchandise item
, such as its name, description, price, and so on.
- On the Force.com platform, these data objects
are called custom objects
.
- 你可以认为这个custom object就代表数据库中的表(table)
- Merchandise detail page
—— 在该页面中可以进行一下操作:adding fields
, relationships
, validation rules
- API
name —— 当你创建完一个Merchandise对象后,你不需要指定一个API
name,已经有一个自动生成了。编程的时候可以使用这个name来引用对象。所有的custom
objects都是以__c
结尾的,因为这样可以跟standard objects区分开
- Standard fields —— 一些自动生成
的字段。例如Owner字段
可以自动跟踪每条记录的创建者
- Custom fields —— 该name也将以__c结尾
Step 2: Add Description, Price, and Total Inventory Fields
Field Lable
可以是使用者看到的,它可以包含一些空格
,但是Field Name是代码中使用的
,不能包含空格和非法字符
,系统会在创建的时候自动使用_(下划线)来替代空格
,并且去掉非法字符
来创建Field Name
Step 3: Create a Tab
- Tab提供了一种查询objects和记录
的快捷
方式。
- 该Tab可以自定义颜色和icon
。
Step 4: Create a Warehouse App
一个application是一些tabs的集合
,你可以创建一个Warehouse
application,然后往里面添加tab
。
Step 5: Create a Merchandise Record
- 这里你就可以创建一个可以运作的应用程序。
- 当你在Force.com中定义了一个object
,Force.com平台就会自动生成一个用户接口(user interface)
来供你创建、读取、更新并且删除记录
。
Tutorial #2: Adding Relationships
你可以把 relationship
想象成一个外键
。
Step 1: Create an Invoice Statement Custom Object
我们现在把invoice name
的数据类型设置为 Auto-Number
,并且设置了一个显示格式(“INV-002”)
。平台会自动分配一个数字
给每一个你创建的唯一的记录
。
Step 3: Relate the Objects
n:n
的关系的时候,添加一个数据类型为Master-Detail Relationship的字段
,再将该字段关联到另一个object
Master-detail relationships也支持roll-up summary fields
,你可以从所有的子记录
中统计有关信息
Tutorial #3: Using Formulas and Validation Rules
Force.com允许你创建公式
和字段验证规则
来帮助维护和提高数据的质量。
Step 1: Calculate a Value for Each Line Item
给 line item
表增加了一个总价值Value字段
:Unit_Price__c * Units_Sold__c
Step 2: Calculate a Value for the Invoice Statement With a Roll-Up Summary Field
给 invoice statement
表增加一个清单总价值 Invoice Value 字段
:SUM
line item 的 Value
Step 3: Check Inventory With a Validation Rule
- 验证line item里的Units Sold不能高于
merchanise里的Total Inventory。
- 注意这里Error Condition Formula
输入的是会出错的公式
:Merchandise__r.Total_Inventory__c < Units_Sold__c。意思就是说,如果发生这样的情况就报错。
-
Merchandise__r
其中的“r”
表示对应的是外键的表
,所以不能用“c”。
Step 5: Improve the Validation Rule
IF(
ISNEW(),
Merchandise__r.Total_Inventory__c < Units_Sold__c ,
IF (
Units_Sold__c < PRIORVALUE(Units_Sold__c),
FALSE,
Merchandise__r.Total_Inventory__c < (Units_Sold__c - PRIORVALUE(Units_Sold__c))
)
)
ISNEW
:如果你是在创建一个新记录
时为true,否则为false
PRIORVALUE
(Units_Sold__c):先前的Units_Sold__c值
Tutorial #4: Using Workflow and Approvals
(类似存储过程
)
- Workflow规则会触发一些动作:基于time triggers、标准和公式的email alerts
、tasks
、field updates
和outbound messages
- Approval processes can automate all of your organization's approvals—from simple to complex
.
Step 1: Populate the Line Item Price Using a Workflow Rule
即在Line Item创建的时候
,给其Unit Price字段赋一个对应外键merchanise.price的值
步骤一:Rule Criteria选中formula evaluates to true
步骤二:在text文本框中输入“true”,这样每次创建记录的时候都为true
步骤三:添加一个Immediate Workflow Actions
步骤四:选中“Use a formula to set the new value”
步骤五:输入公式
步骤六:Activate激活
这个workflow
Step 2: Update Total Inventory When an Order is Placed
创建
line item的时候实时更新对应的库存
(total inventory)
更新
line item的时候也要更新库存
Step 4: Create an Email Template
当某一个清单(invoice statement)的总价超过2000
的时候,发送email给manager确认
Step->Communication Templates->Email Templates
email模板:
{!Invoice_Statement__c.OwnerFullName}
submitted for approval an Invoice Statement that totalled
{!Invoice_Statement__c.Invoice_Value__c} on
{!Invoice_Statement__c.LastModifiedDate}
Step 5: Create an Approval Process
实现
Step 4的需求
三种选择:
Initial Submission
Actions:email发送后,设置status为pending
Final Approval
Actions:manager允许
后,设置status为closed
Final Rejections
Actions:manager拒绝
后,设置status为open
Step 6: Create a User
创建一个只有只读属性
的User,控制他们只能看到部分数据
Administration Setup->Manage Users->
Users
Profile
:Standard User
Manager
:选择你自己
Step 7: Test the Approval Process
查看approval流程图
:App Setup->Create->Workflow &Approvals->Approval Processes->选择创建的approval->View Diagram
- 大小: 40.4 KB
分享到:
相关推荐
[Addison-Wesley Professional] Force.com 平台应用开发 第3版 (英文版) [Addison-Wesley Professional] Development with the Force.com Platform Building Business Applications in the Cloud 3rd Edition (E-...
com.force.json v1.2.2 json 解析神器 ..................
创建随需应变的应用程序 Force.com 平台简介 第1 章 Force.com 平台简介 第2 章 关于示例招聘应用程序 第3 章 复习数据库概念 第4 章 构建简单应用程序 第5 章 通过高级字段和页面布局改进简单应用程序 第6 章 使用...
Force.com Fundamentals is an introduction to the Force.com platform, designed to lead the reader through the functionality provided natively by the Force.com platform. The book walks the reader ...
force.com workbook 2015 pdf
Force.com 工作手册 云应用程序入门
Force.com白皮书,SaaS领域经典应用的,元数据驱动的经典实现
Starting with an introduction to the Force.com model, key features, and advantages of the Force.com platform, this book delves into the design and development of applications on the Force.com platform...
有个哥们10分要,我就看不惯了,2分要的拿去,本来想免费的结果最少要2分不好意思了各位
json解析
Force.com Development Blueprints
Spring for Force.com Developer
The Force.com Multitenant Architecture Understanding the Design of Salesforce.com's Internet Application Development Platform
大多数Force.com开发人员都有多个帐户,并且每次从一个帐户转移到另一个帐户时,都厌倦了输入用户名和密码。此扩展程序执行以下操作:-保留您的salesforce.com帐户信息(用户名,密码,安全令牌和描述) -可让您使用...
SalesforceMobileSDK-iOS, 面向iOS应用的Force.com 移动 SDK 用于iOS的 Salesforce.com 移动 SDK你已经到达了 Salesforce Mobile SDK的源代码库。 欢迎从我们的2.0版开始,现在有三种方法可以以选择使用移动 SDK: !...
Force.com CI 工具 Gulp 任务,用于以 git 友好的方式将元数据部署到 Force.com 并从 Force.com 刷新元数据。 如何使用 将以下文件复制到 Force.com 项目目录中: 包.json 配置文件 sfpackage.json gulpfile.js ...
Force.com Tips and Tricks
Force.com Toolkit for .NET 为 .NET 开发人员提供了一种使用本机库与照明平台 API 交互的简单方法。 .NET 通用库提供了和。 虽然您可以独立使用 .NET 通用库,但建议您通过工具包之一使用它。 NuGet 包 已发布的...
扩展提供最大化的按钮,以最大化画布面积和出口到图像设施。...//作者:Ajay Singh Hada:http://facebook.com/ajay.hada || http://in.linkedin.com/pub/ajay-hada/10/3a7/379 支持语言:English (United States)