您的位置:首页 > 移动开发

Building Applications with Force.com and VisualForce(Dev401)(十六):Data Management: Introduction to Upsert

2013-09-03 17:56 597 查看
Dev401-017:Data Management: Introduction to Upsert

Module Objectives
1.Define upsert.
2.Define external ID.
3.List typical use case where upsert is useful.
4.List typical use case where upsert with relationships is useful.
5.Explain how external IDs are used in combination with upsert.
6.Explain some advantages of making use of an external ID field in a Force.com application.

Upsert
1.Upsert is an API function that combines insert and update into a single call
2.Upsert users an indexed custom field or external ID to determine whether to create a new object or update an existing object.
- If the external ID is not matched, then a new object is created
- If the external ID is matched once, then the existing object is updated
- If the external ID is matched multiple times, the an error is reported
3.Use Upsert when importing data to prevent the creation of duplicates.

External IDs
1.External ID is a flag that can be added to a custom field to indicate that is should be indexed and treated as an ID.
2.Custom index on any custom field of type Text, Number or Email.
3.Available on all objects that support ustom fields.
4.User-defined cross-reference field.
5.Why is ti important?
- Increases report and API SOQL performance
- Used with upsert to easily intergrate apps with other systems
6.An object can have three(3) External ID fields.

Upsert and External ID Typical Use Case
1.Legacy Position records in and old Recruiting Application have a Legacy Position Number.
2.Create a custom text field called Legacy_Position_Number on the Salesforce Position object. Flag the new field as an external ID.
3.When importing Position data from Legacy system to Salesforce, use the Upsert function in combination with the Legacy_Postion_Number field instead of using the Crate or Update API calls.

Upset with Relationships
1.Allows use of relationships defined in legacy systems when importing data into Force.com apps.
2.Configure upsert action to traverse object relationships defined in your Force.com app, but use external IDs from legacy system to discover Force.com record IDs.
3.No need to know Force.com records IDs to load data!
4.Very convenient for intergrations and migrations
- Shifts more of the work Salesforce.

Review
1.What is the advantage of performing upserts rather than creates on large data sets?
Prevent duplicates;external ID
2.How do you make a field an External ID field?
Checkbox
3.Do you have to know the Salesforce IDs of records in order to use Upsert with relationships?
No
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐