Requirement: To track tickets in Salesforce using Case object. So if users have issues in Salesforce they would create a Case.

Example: If a user has an issue with an Account record -> they would create a Case - put in the description of the issue, but we want the user to attach the record, in this case, an account record to the case using a lookup so that we track the tickets back to the record.

Issue: An issue can arise from multiple objects and we do not want to create multiple lookup fields for all the objects we have from Case object. Salesforce does not support muti-object lookup except for tasks, Is there any other way to achieve this?

  • Realistically, the best you could do would be to advise users to create a task to relate to the appropriate record, or write a VF page that gives the user the same type of possibility.
    – sfdcfox
    Oct 3 '17 at 3:29
  • @sfdcfox thanks for the comment, we would like to use email to case functionality in Salesforce.So when issues come through emails we want to create a ticket, and then the admin would attach the record to the case in this situation. This is one of the reasons why we are taking case approach, as you recommend taking VF approach what should my VF page have? can you give me an idea so that I can build my page. Because I am struggling to achieve this functionality without creating multiple lookups all objects.
    – Danny
    Oct 3 '17 at 10:59
  • 1
    You might not need a page at all, if your intent is to link objects to a case. Just create a new Activity custom field that is a lookup to the case, and then you can have admins attach a task to the case with the Related To lookup field selecting the other object. This would allow users to see the relationship between the Case and the other object, and would probably solve most of your problems.
    – sfdcfox
    Oct 3 '17 at 11:22

You cannot create custom polymorphic fields, no. The best you can do is vote for this idea:

Custom Polymorphic Id field (WhoId/WhatId)

When creating a custom SObject that needs to be related to lots of different SObjects the use of a polymorphic Id field would be ideal.Then developers would not need to know what is in the user environment, or rely on admins setting up their app correctly.


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.