+ Start a Discussion
Mac SwiftMac Swift 

validation rule on the Quote Line Item

I need to write  a validation rule on the Quote Line Item that if my formula field "Product" contains some letter for example "ABC". Then it is required to mention the reason in the "Reason" field on the Quote Line Item.  Please help me guys.
Best Answer chosen by Mac Swift
surya kanadhipatlasurya kanadhipatla
Mac,
You need to write this validation under "Quote Line Item Validation Rules" and minor modification is

AND(!ISBLANK(Product2.Product),CONTAINS(Product2.Product, "ABC"),ISBLANK(Product2.Reason))

All Answers

surya kanadhipatlasurya kanadhipatla
Mac Swift ,
​Assuming both the fields are on same object, can try as below:
AND(!ISBLANK(Product),CONTAINS(Product, "ABC"),ISBLANK(Reason))




 
surya kanadhipatlasurya kanadhipatla
Mac,
You need to write this validation under "Quote Line Item Validation Rules" and minor modification is

AND(!ISBLANK(Product2.Product),CONTAINS(Product2.Product, "ABC"),ISBLANK(Product2.Reason))
This was selected as the best answer
Mac SwiftMac Swift
Thanks Surya,
I am able to resolve my issue.

Could you help me with one more query. In the same scenario if we want to change the field type to lookup what would be the validation formula?

I mean if we have the Custom lookup field - "Vendor". If any value is selected in this field we want to make the "Reason" field mandatory on quote line item.
surya kanadhipatlasurya kanadhipatla
Mac , Glad to know that , you resolved the issue. Sure, we can do. so my understanding is if Product2.Product contains some text "ABC" or Vendor Look up is Not blank, Reason is required. If my assumption is right below validation works: AND(OR(!ISBLANK(Product2.Vendor),CONTAINS(Product2.Product, "ABC")),ISBLANK(Product2.Reason))
Mac SwiftMac Swift
Surya Thankyou so much for the quick reply!

Complete Scenario is - If we select any value in Custom lookup field - "Vendor" on the quote line item, then "Reason" field is mandatory on quote line item. (Nothing related to the Product name contains "ABC")
Mac SwiftMac Swift
Thanks Surya for the help! I got this
surya kanadhipatlasurya kanadhipatla
Mac, Glad , you resolved it , have a nice day :)