
Contact Picker
by Dave GrahamThe Contact Picker Module’s goal is to abstract the activity of searching for existing contacts, as well as adding new contacts. In most CRM solutions, it can be called from many different contexts. The first example (see Contacts Demo) is used when creating a new contact. In this scenario the picker is used to search the database first to prevent users from adding a duplicate contact. The second example (see Contacts Demo) is adding a related contact, which creates join records relating the contacts to each other. Dig in and have a look at each of the handlers to get a sense of what’s possible.
Other potential use cases is to pick a contact to attach to an email, note, or other activity record. There are an infinite amount of use cases for this picker!
Methodology
Every use case will have a workflow that will need to run after the contact is picked (or created). We can’t lock the user in a pause/resume loop because the magic which performs the search will not run if a script is paused. For this reason we install a handler using the On Timer script in the contact file. The handler’s job is to “watch” the picker and resume after a contact was picked or created (or to determine if the operation was canceled).
Recommended Usage
I recommend copying the scripts out of the Contact Demo file into your own Contacts database, but the picker file should remain separate from your solution. Since it has minimal dependencies it is quite easy to integrate as a separate file, and because it’s designed to work in a pop-up window there’s almost no benefit to merging this into your primary contact database. Open the Contact Demo file first and follow the instructions in the README, then follow the instructions in the README for the Contact Picker file.
Hi,
you forgot to catch a user abort in your demo:
If you open the picker and press the cancel button, a search request is starting and says no records found…
Anyway: is it really good to jump to the new added related record?
If I want to add a few new related persons to the same contact this could be very confusing.
karo
Good catch Karo. I modified the behavior when adding a related contact to only go to the added contact if the user created a new contact. In my production version I have a multi-select feature; you can continue searching and selecting contacts, and add them all at once without leaving the search dialog. If enough people think it would be valuable for this module I’d be happy to add it.
I would say adding the mule-sdelector would be well worth it to many folks
Multiple selections is coming soon in v2. 🙂
This is so cool! thanks Dave!
Hi Dave,
I have a use case where adding multiple contacts is a typical task. I would really appreciate having the feature in your module.
Thanks for adding this module to the site!
Tom
Dave,
I’m very curious to know why you looped through the fields on the layout, adding a new find request for each, rather than using Quick Find. Is there an advantage to using the looping method vs Quick Find?
Good question. Should’ve added a comment in the script. This way allows for more operators.
From the FileMaker Help on Quickfind:
The only supported operator is the match phrase or “ “ operator. Other operators such as “=”, “==” or “…” are not supported.
Hi David-
Thanks for the hard work and creativity it took to build this. I just installed it in a solution and wrote about it on my blog: http://www.filemakerprogurus.com/contact-picker-modular-filemaker/.
Keep up the good work!
Don
When I try and examine the file by going into Edit mode, I get “This file is Not modifiable”.
How can I turn this error off?
Thanks
I suspect that you are on Windows and are trying to edit the file inside of the ZIP archive. Right+Click on the folder and select Extract All.
– Dave