ISCHANGED(Pricebook2Id) returns false in validation rule when adding a Pricebook to an Opportunity in Lightning Experience
Last updated 2018-02-10 ·Reference W-4274290 ·Reported By 3 users
In Lightning Experience, adding a Price Book to an Opportunity which had no Price Book will cause ISCHANGED(Pricebook2Id) to unexpectedly return "false" in validation rules.
This is because currently when a price book is added or changed on an Opportunity in Lightning we make 2 updates to the Opportunity; The first sets Pricebook2Id to null to remove any existing Line Items, while the second updates Pricebook2Id with the selected Price Book. When the Opportunity Pricebook2Id was already null, the update which sets it to null does evaluate validation rules, and ISCHANGED(Pricebook2Id) is false because the old and new values in that update are both null.
1. Create a validation rule on Opportunity using NOT(ISCHANGED(Pricebook2Id)). For example: NOT(ISCHANGED(Pricebook2Id)) && NOT(ISNEW())
2. In Classic, create an Opportunity, save it, then click Choose Price Book in Products related list and select a price book. Save.
Result: Notice that Price Book is set as expected.
3. In LEX, create an Opp, Save, and attempt to add a Price Book
Result: Message is displayed "The Price Book update failed. Please try again."
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.