Data Modeling / Database Design Flashcards
Converting Relationships
- You can convert a master-detail relationship to a lookup relationship as long as no roll-up summary fields exist on the master object.
- Converting a master-detail relationship to a lookup for a custom object on the “detail” side, changes the organisation-wide default for the object to public read/write.
- You can convert a lookup relationship to a master-detail relationship if the lookup field in all the records contains a value.
- A lookup relationship can’t be changed to a master-detail relationship if the organisation-wide default of the child object access level in the relationship is Controlled by Parent.
- Converting a lookup to a master-detail-relationship changes the organisation-wide default to Controlled by Parent and the sharing model is updated to public read/write.
Realtionships and Reports
- Lookup relationships allow data from the two related objects to be joined in one report.
- Master-detail relationships allow data from three objects to be joined in one report: the master object, the detail object, plus one other lookup object. If the detail object has multiple lookup relationships, a separate report type is available based on each lookup.
- Many-to-many relationships provide two standard report types that join the master objects and the junction object. The report types are:
- “Primary master with junction object and secondary master” in the primary master object’s report category.
- “Secondary master with junction object and primary master” in the secondary master object’s report category.
- The order of the master objects in the report type is important. The master object listed first determines the scope of records that can be displayed in the report.
IMPORTANT Converting a relationship from lookup to master-detail or vice versa can cause existing custom reports to become unusable due to the different standard report types available for each type of relationship. We recommend that you test your custom reports immediately after converting the relationship type. If you revert your relationship back to the original type, the reports are restored and become usable again
Audit Fields
Enable ‘Create Audit Fields’
- From Setup, enter User in Quick Find box and select User Interface.
- Select the checkbox for Enable “Set Audit Fields upon Record Creation” and “Update Records with Inactive Owners” User Permissions.
- Click Save.
After enabling these organization wide permissions:
Grant the following profile permissions to your Users with custom profiles (see notes below for standard profiles):
- Set Audit Fields upon Record Creation - Allow the User to set audit fields (like ‘Created By’ or ‘Last Modified By’) when you create a record via API importing tools like Data Loader.
- Update Records with Inactive Owners - Allow the User to update record owner and sharing-based records with inactive owners.
- *Notes**:
- *Standard profiles** cannot be granted these permissions. Instead, use a permission set as described in Enable ‘Create Audit Fields’ permission for standard profiles.
Optional: create and configure a permission set
- From Setup, follow the steps outlined in Create Permission Sets.
- While creating the permission set, grant either the “Set Audit Fields upon Record Creation” or “Update Records with Inactive Owners” permissions under “System Permissions.”
- Click Save.
- Follow the steps in Assign a Permission Set to Multiple Users.
Price book
A price book is a list of products and their prices.
- The standard price book is the master list of all your products and their default standard prices. Salesforce creates the standard price book when you start creating product records. It includes all your products and their standard prices regardless of any custom price books that include those products.
- A custom price book is a separate list of products with custom prices, called list prices. Custom price books are ideal for offering products at different prices to different market segments, regions, or other subsets of your customers. Create a separate price book for each set of customers that you want to address. For example, if you have one set of prices for domestic customers and another for international customers, create a domestic price book and an international one.
Changing price book in an opportunity
If you change the price book for an opportunity that has products, all products are deleted from the Products related list, but the value in the opportunity’s Amount field remains.
You can use the Salesforce mobile app to relate a price book with an opportunity that doesn’t already have one.
To change an opportunity’s price book, use the desktop Salesforce site.
Deleting a price book entry
- You can delete products from custom price books without affecting the original product listing or its entries in other price books.
- When you delete a product from the standard price book, the product is still available and active, but its standard price is deleted and removed from all custom price books.
- If you delete the product from the standard price book, and it’s still associated with any custom price books, click OK to remove it from all custom price books.
Deleting Price Books
- Deleting, deactivating, or archiving a custom price book doesn’t affect other price books or your product lists. However, these actions can affect your opportunities and quotes. Changing associations with opportunities or quotes is sometimes required before you can remove an associated price book.
- You can deactivate the standard price book, but you can’t delete or archive it.
You can’t recover or delete an archived price book.
Regenerate a File Preview
If a file preview is of poor quality, you can try to regenerate the preview. Available for Salesforce Files and CRM content documents that can be previewed.
When you regenerate a preview, the new preview request is added to a queue and the existing preview is deleted. During this time, users won’t see a file preview.
File previews aren’t available for files larger than 25 MB, unknown file types, password-protected files, and copy-protected PDFs. For files that you can’t preview, the Preview option isn’t available on feeds or list views, and files appear as generic file type icons in the feed.
Mapping Set
A mapping set is a group of related objects that need to be mapped between the data source and the Cloud Information Model.
It aligns and transforms the data across the connected orgs.
Used in Customer 360 Data Manager
Geolocation fields
A geolocation field counts toward the org’s limits as three custom fields.
Only the individual field components of a geolocation field can be modified or exported.
Although longitude values can be within -180 and 180, latitude values must be within -90 and 90.
Also, the DISTANCE formula is used to calculate the distance between two locations in miles or kilometers.
The GEOLOCATION formula returns a geolocation based on the provided latitude and longitude and must be used with the DISTANCE function.
Self Relationship
A self-relationship can be defined using a lookup relationship field to relate an object to itself.
For example, the Flight object can be related to itself.
Audit Fields
The ‘Enable Set Audit Fields upon Record Creation’ user permission allows a user to set audit fields, such as Created By, Last Modified By, and Created Date.
VS Code
Salesforce Extensions for Visual Code and Metadata API can be used to retrieve, deploy, create, update or delete customization information.
Mapping set
A mapping set is a group of related objects that includes a source schema and a target schema.
Mapping sets can be created between objects and fields within the source schema and the Cloud Information Model.
Mapping sets can be edited by adding other objects and fields.
Mapping Version
A mapping version needs to be activated when data from one source needs to be used in another data source
Person Accounts
Account news is available only for business accounts - NOT person accounts
If person accounts are enabled, the organization-wide default sharing must be set in one of the following ways. Contacts are set to Controlled by Parent, or accounts and contacts are both set to Private.
Managing Ownership Skew
If you do have a compelling reason for assigning ownership to a small number of users, you can minimize possible performance impacts by not assigning the user(s) to a role.
If the user(s) must have a role to share data, we recommend that you:
- Place them in a separate role at the top of the hierarchy
- Not move them out of that top-level role
- Keep them out of public groups that could be used as the source for sharing rules
Tuning Group Membership for Performance
- Identify user and group updates that are complex, such as user role and portal account ownership changes, or updates that involve a large amount of associated data. Allow for additional time to process these changes.
- When making changes to the hierarchy, process changes to the bottom (leaf) nodes first, then move upward to avoid duplicate processing.
- Limit the number of records of an object owned by a single user to 10,000.
- Tune your updates for maximum throughput by experimenting with batch sizes and using the bulk API, where possible.
- Remove redundant paths of access, such as sharing rules that provide access to people who already have it through the hierarchy.
- Schedule large group membership operations during off-peak hours.
Record Level Locking
When updating child records in Salesforce, the system locks the parent and the child records to prevent inconsistencies
When objects being processed have a parent-child relationship, two situations in particular pose a risk of producing locking errors.
- Updates to parent records and their children are being processed simultaneously in separate threads.
- Updates to child records that have the same parent records are being processed simultaneously in separate threads.