Developer Fundamentals 2 Flashcards
Which of the following are true regarding the user interface for different relationship types?
Choose 2 answers.
A. When a many-to-many relationship is defined between objects A and B using a junction object, data from the junction object can appear in a related list on the page layouts of objects A and B
B. When a master-detail relationship is defined, data from the master or detail object can appear as a custom related list on page layouts of the other object
C. When a lookup relationship to (parent) object B is defined on (child) object A, data from object A can appear as a related list on page layouts of object B
D. When a lookup relationship to object B is defined on object A, data from object B can appear as a related list on page layouts of object A
A. When a many-to-many relationship is defined between objects A and B using a junction object, data from the junction object can appear in a related list on the page layouts of objects A and B
B. When a master-detail relationship is defined, data from the master or detail object can appear as a custom related list on page layouts of the other object
When a lookup relationship is defined, data from the lookup object can be displayed in a custom related list on the other object. For example, if a custom object named Schedule is related to a custom object called Training Course, a list of related Schedule records can be displayed on the Training Course record page.
When a many-to-many relationship is defined, data from a junction object can be displayed on page layouts for either object.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/relationships_among_objects.htm
https://trailhead.salesforce.com/content/learn/modules/data_modeling/object_relationships
Universal Containers has tried the Schema Builder but has found that it has long loading times and objects are difficult to find because there are too many objects and relationships displayed. What features would you suggest to help with this issue?
Choose 3 answers.
A. The map can be used to navigate to objects of interest
B. If the ‘Hide Relationships’ option is selected, performance is improved
C. Fields can be hidden and only the objects displayed
D. The filter can be used to only display objects of interest
E. Activate lightweight mode in the Schema Builder settings
A. The map can be used to navigate to objects of interest
B. If the ‘Hide Relationships’ option is selected, performance is improved
D. The filter can be used to only display objects of interest
Objects can be hidden on the canvas while fields cannot. Schema Builder does not have a lightweight mode feature either.
Hiding the relationship details reduce the rendering work needed on the canvas. Using the Objects filter minimizes the number of objects that need to be rendered. Using the map feature helps navigate the canvas much quicker and find the required object.
https://help.salesforce.com/s/articleView?language=en_US&id=sf.schema_builder.htm&type=5
https://trailhead.salesforce.com/es/content/learn/modules/data_modeling/schema_builder
Which class contains methods that can be used to retrieve schema metadata information in Apex?
Choose 1 answer.
A. Schema
B. Metadata
C. System
D. Database
**A. Schema **
The Schema class contains methods that can be used to retrieve schema describe information. For example, to return a map of all sObject names to sObject tokens for standard and custom objects in the org, the following can be used:
Map<String, Schema.SObjectType> results = Schema.getGlobalDescribe();
The Database class contains methods that are used for creating or modifying data. The System class contains methods related to system operations, such as writing debug messages and scheduling Apex jobs. The Metadata class is an abstract base class that represents a custom metadata component.
What are the implications of using an External ID to relate child records to a parent record?
Choose 2 answers.
A. A parent record reference is created and added to the relationship field of the child record
B. The child record must have a relationship field that associates it to the parent record
C. Relating records using an External ID only works for inserts and not for updates nor upserts
relationship field of the child record
D. An External ID field must also be defined at the child record to establish the relationship
✔️A. A parent record reference is created and added to the relationship field of the child record **
✔️B. The child record must have a relationship field that associates it to the parent record **
An External ID field can be used to associate records instead of the usual record ID. When relating records using this approach, the child object must have an existing relationship field to the parent object such as a lookup or master-detail relationship. This relationship field is where the parent record reference is added and establishes the association between the two records.
This External ID is only necessary at the parent object, and relating records using this approach will work for insert, update, and upsert operations.
A currency field on the Product object called ‘Cost’ is being used for storing the cost of the product. The product cost is displayed on the Opportunity Product object using a formula field called ‘Product Cost’. The total product cost of the Opportunity Product records needs to be displayed on the parent opportunity. Which of the following is the most suitable option for meeting this requirement?
A. Create an Apex trigger that computes and saves the total product cost of the Opportunity line items on the Opportunity object
B. Create a roll-up summary field on the Opportunity object based on the Product Cost formula field on the Opportunity Product.
C. Create a master-detail relationship between the Opportunity and Product and summarize the Product’s Cost field values on the Opportunity object
D. Create a flow that copies the Product’s Cost value to a custom field on the Opportunity Product and summarizes this field on the Opportunity object.
**✔️D. Create a flow that copies the Product’s Cost value to a custom field on the Opportunity Product and summarizes this field on the Opportunity object. **
The most suitable option is to create a record-triggered flow that copies and stores the Cost value of the related Product in a custom currency field on the Opportunity Product object. This flow can be configured to fire each time an Opportunity line item (Opportunity Product) is added, for example, to an opportunity. Then, a roll-up summary field can be used to summarize and display the total product cost on the Opportunity object.
Salesforce does not allow cross-object formula fields or formula fields that reference fields from another object, to be used in roll-up summary fields. Programmatic customization is not necessary in this scenario as the requirement can be met using a declarative option. Creating a new relationship between the Product and Opportunity object is not recommended nor necessary as the Opportunity Product object is being used for this purpose.
What type of relationship is appropriate when an external object is acting as a parent to a standard or custom child object and records are matched by an external ID?
A. Lookup relationship
B. Parent External Lookup
C. External Lookup
D. Indirect Lookup
C. External Lookup
An external lookup relationship links a child standard, custom, or external object to a parent external object.
A lookup relationship is used to link a child standard, custom, or external object to a parent standard or custom object. An indirect relationship is used to link a child external record to a parent standard or custom object.
To fulfill a business requirement, a formula field of a detail object has been used in a roll-up summary field of a master object. Which of the following is a valid statement regarding the formula field?
A. The formula field expression cannot be updated.
B. The formula field is not allowed to return an error.
C. The formula field is restricted to returning numeric values only.
D. The formula field cannot reference a field from another object.
D. The formula field cannot reference a field from another object.
A roll-up summary field can calculate the value of formula fields unless:
– The formula field contains cross-object field references
– The formula field contains functions that derive values dynamically, such as NOW or TODAY
Number, currency, percent, date, and date/time fields are available depending on the roll-up type.
Referencing a formula field in a roll-up summary field does not prevent making changes to that formula field.
A formula field may return an error, such as “#Error!”, which is allowed and does not affect roll-up summary fields using COUNT. However, roll-up summary fields using MIN, MAX, or SUM exclude the field value from the calculation and affect their summarized total.
Project managers would like to be able to record the total amount of hours each team member works on projects. A team member can be related to multiple projects and each project can have multiple team members. How can the developer achieve this?
A. Create a lookup relationship on both objects to a junction object called Project Team Member.
B. Create a master-detail relationship on the Project object to the Team Member object.
C. Create master-detail relationships from a junction object ‘Project Team Member’, one to the Project object and one to the Team Member object
D. Create a master-detail relationship on Project and Team Member objects to a junction object ‘Project Team Member’.
C. Create master-detail relationships from a junction object ‘Project Team Member’, one to the Project object and one to the Team Member object
In this case, as a team member can be related to multiple projects and each project can have multiple team members, a many-to-many relationship is required. Creating the many-to-many relationship consists of creating the junction object (e.g. Project Team Member) and creating two master-detail relationships on Project Team Member, one to Project and one to Team Member. When creating master-detail relationships, the relationship field is created on the detail object. The detail object, in this case is, Project Team Member.
https://help.salesforce.com/s/articleView?language=en_US&id=relationships_manytomany.htm&type=0
https://trailhead.salesforce.com/data_modeling/object_relationships
Which of the following provides a dynamic environment for viewing and modifying objects and relationships?
A. Schema Builder
B. Process Builder
C. Flow Builder
D. Lightning App Builder
A. Schema Builder
Schema Builder provides a dynamic environment for viewing and modifying objects, fields, and relationships in the org using drag-and-drop actions. The tool can be used to easily view relationships between objects in its interactive graphical user interface.
Process Builder is used for building processes. Flow Builder is used for building flows. Lightning App Builder is a tool used for building Lightning apps and pages.
https://help.salesforce.com/s/articleView?language=en_US&id=sf.schema_builder.htm&type=5
https://trailhead.salesforce.com/es/content/learn/modules/data_modeling/schema_builder
Which of the following field types can a Roll-Up Summary field calculate?
A. Number
B. Picklist
C. Text
D. Checkbox
A. Number
If SUM is selected as the roll-up type, number, currency, and percent fields can be calculated.
If MIN or MAX is selected as the roll-up type, number, currency, percent, date, and date/time fields are available.
A developer needs to create a custom object related to Account. How can the developer ensure that all related records are also visible to users that have access to the parent Account?
A. Create a Lookup relationship field on the Account.
B. Create a Lookup relationship field on the Custom Object.
C. Create a Master-Detail relationship field on the Account.
D. Create a Master-Detail relationship field on the Custom Object.
D. Create a Master-Detail relationship field on the Custom Object.
The detail object in a master-detail relationship inherits the sharing settings of the master object. This relationship is established by creating a master-detail relationship field on the detail object.
The detail object in a master-detail relationship inherits the sharing settings of the master object. This relationship is established by creating a master-detail relationship field on the detail object.
A developer created a lookup relationship field on a custom object called “Feedback” that references the Account object. Which statement is correct?
A. If an account record is deleted, related feedback records will not be deleted.
B. Any user that can view an account record can also view its related feedback records.
C. The owner of the account record will be the owner of its related feedback records.
D. If an account is deleted, related feedback records will also be deleted.
✔️**A. If an account record is deleted, related feedback records will not be deleted. **
Deleting either a parent (account) or child (feedback) in a lookup relationship does not cause the other to be automatically deleted. A lookup can be configured to prevent deletion of a parent record (account) if it has children (feedback). Additionally, ownership is independent in lookup relationships (parent and child records can have different owners and sharing models).
Master-detail relationships are different. When a master record is deleted, all of its detail records are also deleted. Record-level sharing of detail records is the same as its master (if a user can view a master record, he/she can also view its detail records).
What is true regarding record access in a master-detail relationship?
Select two ansers:
A. The detail object can have its own sharing rules
B. The record owner can be changed on the detail object
C. The detail object inherits the sharing and security settings of the master record
D. The owner of a master record is automatically used to set the owner of its associated detail records
C. The detail object inherits the sharing and security settings of the master record
D. The owner of a master record is automatically used to set the owner of its associated detail records
The Owner field on the detail object is not available and is automatically set to the owner of its associated master record. Custom objects on the detail side of a master-detail relationship cannot have sharing rules, manual sharing, or queues, as these require the Owner field. The detail record inherits the sharing and security settings of its master record.
Universal Containers would like to see a Red / Yellow / Green traffic light representation on the Opportunity detail page based on the value of the Opportunity Probability field. What can be used to achieve this?
A. Formula Field
B. Master-Detail Relationship Field
C. Rich Text Field
D. Image Field
✔️A. Formula Field
An image (stored in documents) can be displayed conditionally using a formula field using the IMAGE() function.
A master-detail relationship field is used to establish a relationship between two objects where the parent is the master object and the detail is the child object. Although a Rich Text field can be used to display an image, it does not support any dynamic functionality such as conditionally displaying an image based on the value of a field on a record. An ‘Image’ field does not exist.
https://help.salesforce.com/s/articleView?id=000385501&type=1
A Salesforce administrator is required to define a custom field on the User object that would record a user’s secondary manager in a matrix organizational structure. Which relationship type should be used to achieve this?
A. None of these options
B. Hierarchical
C. Lookup
D. Master-detail
✔️**B. Hierarchical **
Lookup and master-detail relationships are not available on the User object. The User object can only be linked with itself, which is possible by using a hierarchical relationship.
The Salesforce Administrator is building an application and needs to create a master-detail relationship between the Account standard object and a custom object. What is true regarding the relationship?
Select two option:
A. The object on the detail side will inherit the security and sharing settings of the master object
B. The standard object is always the master
C. The standard object can be on the master or detail side of the relationship
D. The custom object can be on the master or detail side of the relationship
✔️ ** A. The object on the detail side will inherit the security and sharing settings of the master object **
✔️ ** B. The standard object is always the master **
In master-detail relationships between standard and custom objects, the standard object is always the master. The detail records will inherit the security and sharing settings of the master.
A developer needs to update existing Account records using an import file. How can the records be matched so that the correct record is updated?
Select two options:
A. Match the Account Name to a column in the import file
B. Match the record id field to a column in the import file
C. Match the order of the data in the import file to the order of the records in Salesforce
D. Match an external id field defined on the account object to a column in the import file
✔️**B. Match the record id field to a column in the import file **
✔️**D. Match an external id field defined on the account object to a column in the import file **
An External ID field or the Salesforce ID can be used to match records from an import file to existing records in Salesforce. If using the Data Import Wizard, there is also the option to match based on the combination of Account Name and Site.
https://help.salesforce.com/s/articleView?language=en_US&id=for_accounts_and_contacts.htm&type=5
A Salesforce Administrator working for Cosmic Solutions has created a formula field on the Opportunity object to calculate discounts based on the values of certain numeric fields on the object. A developer is using the formula field in an Apex class and needs to determine whether the formula field treats the numeric fields that are empty as zeros. Which method of the DescribeFieldResult class can be used to obtain the information?
A. isFormulaTreatBlankNumberAsZero()
B. isFormulaTreatNullNumberAsZero()
C. isFormulaNullNumberZero()
D. isFormulaBlankNumberZero()
✔️**B. isFormulaTreatNullNumberAsZero() **
The isFormulaTreatNullNumberAsZero() method of the DescribeFieldResult class returns true if null is treated as zero in a formula field, and false otherwise.
La función isFormulaTreatNullNumberAsZero() en Salesforce determina cómo se manejan los valores nulos en fórmulas numéricas. Si esta función devuelve true, cualquier campo numérico que sea null dentro de una fórmula será tratado como si su valor fuera 0. Si devuelve false, los valores nulos permanecerán como tal.
Ejemplos prácticos:
Fórmula de suma:
Con isFormulaTreatNullNumberAsZero() = true: null + 5 será igual a 5.
Con isFormulaTreatNullNumberAsZero() = false: null + 5 será igual a null.
Descuentos: Si estás calculando descuentos basados en cantidades opcionales, un valor nulo se convierte en 0 y no afecta el cálculo.
Global Insurance has custom objects to represent policies and claims. A policy can have zero or many claims. A claim is always related to a policy. Claims are first assigned to a queue and then later assigned to different members of the claims team. What type of relationship would be used to relate the policy and claim objects?
A. Master-detail relationship
B. Lookup relationship
C. Self-relationship
D. Direct relationship
✔️**B. Lookup relationship **
In this case, queues are required to manage and allocate claims. A queue requires an owner field, which is not available on child records in a master-detail relationship, so a lookup relationship between policy and claim would be required. The lookup relationship can be set up to always ensure that a claim is always related to a policy.
Self-relationship is a relationship between one record and another record of the same object type. Direct relationship is not a valid type of relationship in Salesforce.