Salesforce Certified Platform Administrator II free question 6 / 10 · Domain 4: Cloud Applications
An org has Products and Schedules enabled, and also Enable Quantity and Revenue Schedules for custom schedule use. The product Maintenance Pack has a default revenue schedule. An administrator creates the custom field Billing Type on OpportunityLineItemSchedule and adds a validation rule that blocks saving when Billing Type is empty. A sales rep adds Maintenance Pack to an opportunity, and the default schedule is created automatically. Which statement matches the Object Reference (Summer ’22)?
- The validation rule does not run on the automatic schedule, but Apex triggers do run, so a trigger can fill in Billing Type
- On the first creation, the validation rule does not run, and the schedule is created with Billing Type empty
- The validation rule runs on the automatically created schedule, and because it fails, adding the product to the opportunity cannot be saved
- The validation rule runs on the automatically created schedule, and the schedule rows that fail are not created while the remaining rows are
Show the answer and explanation
Answer: B
Why this is correct
The OpportunityLineItemSchedule article says that when custom schedules are enabled, default schedules can use custom fields, but validation rules and Apex triggers are skipped when the schedules are first created (inserted). Adding a product that has a default schedule to an opportunity also creates the schedule records. On that first creation the validation rule does not run, so the schedule is created with Billing Type empty.
Why the other options are wrong
"The validation rule runs on the automatically created schedule, and because it fails, adding the product to the opportunity cannot be saved" … The guide says validation rules are skipped when default schedules are first created. Even though the record breaks the rule, adding the product is not stopped.
"The validation rule runs on the automatically created schedule, and the schedule rows that fail are not created while the remaining rows are" … Validation rules are skipped on the first creation of default schedules, so no rows are rejected. The behavior in which only the failing rows are left out does not occur.
"The validation rule does not run on the automatic schedule, but Apex triggers do run, so a trigger can fill in Billing Type" … The guide says both validation rules and Apex triggers are skipped on the first creation. A trigger that fills in Billing Type does not fire at that point.
Key point
From API version 46.0, the schedule objects support custom fields, validation rules, and Apex triggers, and delete triggers run when schedules are deleted. When an opportunity product is created from a product with a default schedule, schedule records are created too (API 38.0 and later). The schedule type (quantity, revenue, or both) has to match the product setup and any existing schedules.