Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am having one custom object name as club with custom lookup field with contact object.

Let us assume we have 3 records in my club object(club1,club2 and club3).

When I assigned one member to club1 record , I shouldn't assign the same member to another record either in club2 or club3.

If I try to assign the same member to other club records I should be stopped with an error message.

How this can be achieved.

Thanks in advance

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

As a Lookup can not be unique, you will have to create a new text field(e.g:ContactId__c) and make it Unique, that's very important. Then by workflow, you can populate this text field from your custom lookup.

So now that means when you create a new member for the same contact, you will get the following error : "Duplicate value on record: 'Record_Name' (Related field: ContactId)"

share|improve this answer
    
Thanks its working fine. Can I customize this error message "Duplicate value on record: 'Record_Name' (Related field: ContactId)". –  Rajeshkumar Apr 22 at 9:59
    
Unfortunately not with this solution. If you want a custom error message, you will need to go for a solution with a trigger which is more expensive as you will need some code and a developer. –  brovasi Apr 22 at 10:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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