How to check if unrelated record exists: to relate to it, or create new entry and relate to that


I have a custom module that stores ‘site addresses’.

When creating an opportunity, the user inputs an address that may already be recorded in the custom site address module.

If it does exist, i want to relate it to the opportunity, if not it should create a new site address record and relate to that.

What is the best way to go about this? It doesn’t seem possible in a workflow? If creating a logic hook, can i create a popup to let the user know what has happened, or select possible matches?

thank you

Hi, @Bungle
You can:

  1. make relationship one-to-many
  2. add this field to editview
  3. user will be search and select from ‘site addresses’
  4. if this address there is not in list, user create this address (for example to see array ‘create’ in ‘modules/Contacts/metadata/popupdefs.php’)
1 Like

omg, now i’m kicking myself!

thank you