We have a Visualforce page on the case object which is used to create quality issue related cases of our customers. We have different functional areas such as Design, Quality etc., For ex, customer A has an issue related to his product quality, we create a case, say the custom case number is (QR-121). That issue is resolved and case will be closed. Customer has another product which has the same issue with product quality in the near future. so, we create a case, assume the case number is (QR-145). Since there's a similar case resolved earlier for the same customer, we want to use that case as a reference and add it to the current visualforce page. I've a look up field to case object to add the reference case (QR-121), but when I try to look up for (QR-121), it obviously won't show any records, as the lookup is associated with the standard case number. How can I be able to add reference cases by it's custom case number (QR-121) instead of the standard case number?
2 Answers
You can't. Lookup fields always use the "name" field (which for a case, is its case number). You can still query on your custom field and just use the ID that's returned, but the lookup field will always show the case number. There's no way to modify the behavior of how lookup fields work.
Associating lookup fields with any other attribute other than the standard Record ID field is not supported in Salesforce.
Another solution to ease your search process, would be to create an inline Visualforce Page (assuming you are using a standard Case page layout) to search and display the matching Closed cases based on a certain search criteria. The User can then select the specific record, whose Record Id can be associated in the Lookup Field.