Given: Quote has a lookup with Pricebook. I want to write a validation rule on Quote object, to not change the pricebook if Quote line items already exists.
Thank you for your reply! Yes you are correct, Quote line item is a child object. So for that I have made a Roll-up summary on Quote object for storing the count of the line items and I am using that field in my validation rule. I've modified the rule ANUTEJ suggested and it works fine for me:
hi Priya. I think you want if quote line item(lookup of quote) has any record and pricebook is change then validation will be fire. am I right? if I'm right then you can't write validation. instead of it you will have to write trigger because quote line item is the child object and you can't get reference any child object into validtion or formula. let me know did I get you right, then I will be write a trigger for this requirment. Thank you
Thank you for your reply! Yes you are correct, Quote line item is a child object. So for that I have made a Roll-up summary on Quote object for storing the count of the line items and I am using that field in my validation rule. I've modified the rule ANUTEJ suggested and it works fine for me:
Thank you for your reply!
Yes you are correct, Quote line item is a child object. So for that I have made a Roll-up summary on Quote object for storing the count of the line items and I am using that field in my validation rule.
I've modified the rule ANUTEJ suggested and it works fine for me:
AND(
NOT(ISNEW()),
ISCHANGED ( Pricebook2Id ),
LineItemCount >0
)
All Answers
Can you try the below rule once:
then if the above validation rule that checks if the record is not new and if the pricebook2Id field value is changed then you can throw an error.
Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.
Thanks.
I think you want if quote line item(lookup of quote) has any record and pricebook is change then validation will be fire.
am I right?
if I'm right then you can't write validation. instead of it you will have to write trigger because quote line item is the child object and you can't get reference any child object into validtion or formula.
let me know did I get you right, then I will be write a trigger for this requirment.
Thank you
Thank you for your reply!
Yes you are correct, Quote line item is a child object. So for that I have made a Roll-up summary on Quote object for storing the count of the line items and I am using that field in my validation rule.
I've modified the rule ANUTEJ suggested and it works fine for me:
AND(
NOT(ISNEW()),
ISCHANGED ( Pricebook2Id ),
LineItemCount >0
)
You can go through this link..
https://developer.salesforce.com/forums/?id=9060G000000Xfl4QAC
If you find your Solution then mark this as the best answer.
Thank you!
Regards
Suraj Tripathi