-3

I Have 3 objects.

All with MD relationship

"Object 1" Master of "Object 2" and "Object 2" Master of "Object 3".

Now, object 3 has one number field which needs to be checked against picklist field in object 1 for less than comparison. Any Suggestions.

1
  • How many values do you have in your picklist? I'm sure it would be numbers and a finite list. – Nishant Singh Panwar Dec 22 '15 at 11:43
0

If you're after an exact match, the below should work.

Validation rule: text(Object1.Picklist) != text(Object3.Field)

2

OPTION 1:

If you have a finite no of picklist values in your object 1 and are easily manageable I would reccomend to use the ISPICKVAL function.

 IF( 
    ISPICKVAL(Object2__r.Object1__r.PicklistField__c, '1') ,  NumberField__c > 1 , 
    IF( 
        ISPICKVAL(Object2__r.Object1__r.PicklistField__c, '2'), NumberField__c > 2,
        IF( 
            ISPICKVAL(Object2__r.Object1__r.PicklistField__c, '3'), NumberField__c > 3,
            FALSE
        )
    )
)

Similarly you can add on the ISPICKVAL up to the picklist you have.

I can help you better if you share more details on this validation in more precise details.

OPTION 2:

Use the Apex Trigger in Before Insert context and just perform the string to number conversion with Integer.valueOf function and add error.

Thank You.

1
  • Please mark it as solved if what I explained solves the problem else elaborate the problem for more help you need. – Nishant Singh Panwar Dec 24 '15 at 5:20

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.