1

I have a custom object that track several products, but none are required to be filled out. However, if there is a product, I want to make sure my users are inputting all the necessary information. So I created this rule:

AND(
    NOT(ISNULL(Product_1__c )),  
    AND(ISNULL(Quantity_1__c), 
        ISNULL(Part_Number_1__c), 
        ISNULL(Vendor_1__c), 
        ISNULL(Sell_Price_1__c)
       )
   )

What I'm hoping it will do is create an error if they put something in the product field, but don't fill out the rest of the information. I have one for each of my products.

But it isn't working properly when I test. What am I doing wrong?

2

From your requirement, it sounds like you should use OR condition for the other fields. So, your formula will look as follows

AND(
    NOT(ISNULL(Product_1__c )), 
    OR(
        ISBLANK(Quantity_1__c), 
        ISBLANK(Part_Number_1__c), 
        ISBLANK(Vendor_1__c), 
        ISBLANK(Sell_Price_1__c)
   )
)

So, when Product_1__c is not null and any of the other field from Quantity_1__c, Part_Number_1__c, Vendor_1__c and Sell_Price_1__c is blank, it should give an error.

Also, use ISBLANK instead of ISNULL as text fields are never null.

Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality as ISNULL, but also supports text fields. Salesforce will continue to support ISNULL, so you do not need to change any existing formulas.

Text fields are never null, so using ISNULL() with a text field always returns false. For example, the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of the value in the New field. For text fields, use the ISBLANK function instead.

Hope this helps.

  • That's a great start! It worked with my first product, but it also works a little too well with everything else. Now it requires all fields to be filled out. What I'm looking for is IF the product is filled out, all the associated fields need to be filled out. I think this is requiring ALL fields to be filled out... – Dan Watkoski Sep 11 '19 at 15:10
  • 1
    I missed the ISBLANK the first time I read it. Updated it, and it works perfectly! Thank you very much!! – Dan Watkoski Sep 11 '19 at 15:26
  • @DanWatkoski Glad it helped. Please mark this as accepted answer. Thanks. – jagmohan Sep 11 '19 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.