'Required If' formula with 2 conditions - Multiple Statuses and Assigned User Attribute

Hi All,

May I please get some help on a 'Required if' formula on a field in the leads module. This is my first post on Sugar Club.

The requirement is setting a field to be required if the status is any of the following (23 different statuses) and the assigned user belongs to a specific business unit (SYCF). We are excluding 2 statuses 'New' and 'Unable to Contact'.

Was able to set the formula with one status and the business unit. But I'm unable to include multiple statuses in the condition.

The formula I have as of now using multiple statuses (testing with just a few as of now) is:

ifElse(and(or(equal($status,"Discussion"),equal($status,"Inspection"),equal($status,"Considering Offer"),equal($status,"Documents Requested")),equal(related($assigned_user_link,"business_unit_c"),"SYCF")),false,true)

Sugar accepts the formula but this field is now required regardless of the status or the users business unit > basically as if I only checked the box required on the field in studio.

Would truly appreciate some kind help with this. Sugar V12.0

Kind Regards,

Sheldon Pereira

Parents
  • Hi  ,

    Welcome to SugarClub! The best practice for validating on one of many different values is to use the isInList function in conjunction with the createList function to define all potential values. There should be no need to do a ifElse with your formula since you only want the field required if both your conditions are satisfied. You just need to begin the formula with a function that natively returns true or false as a result (e.g. and). The formula should look something like this:

    and(
        isInList(
            $status,
            createList(
                "Discussion",
                "Inspection",
                "Considering Offer",
                "Documents Requested"
            )
        ),
        equal(
            related(
                $assigned_user_link,
                "business_unit_c"
            ),
            "SYCF"
        )
    )

    Let me know how it works for you!

    Chris

Reply
  • Hi  ,

    Welcome to SugarClub! The best practice for validating on one of many different values is to use the isInList function in conjunction with the createList function to define all potential values. There should be no need to do a ifElse with your formula since you only want the field required if both your conditions are satisfied. You just need to begin the formula with a function that natively returns true or false as a result (e.g. and). The formula should look something like this:

    and(
        isInList(
            $status,
            createList(
                "Discussion",
                "Inspection",
                "Considering Offer",
                "Documents Requested"
            )
        ),
        equal(
            related(
                $assigned_user_link,
                "business_unit_c"
            ),
            "SYCF"
        )
    )

    Let me know how it works for you!

    Chris

Children