How do I link FM Chat to my own files & records?
Using Data Detectors
The simplest way to use FM Chat with your solutions is through data detectors. FM Chat runs on your host or server alongside your other FileMaker solutions as its own hosted file. When you need to jump from a chat to a particular record in your solution, you'd use a data detector to let you create a link to that record (or a link that would call a script in your solution).
Linking Chats to Entities (Records)
Again, FM Chat runs as a separate file in your FileMaker host or server. The big advantage of linking is that on a given record in your solution you can have a portal of chats pertaining to that record show up on that record in your file. Here's how to do it:
A Few Notes Before We Begin
Every table that you would like to integrate with chat will need the following steps completed. Let's start with one table and you can reproduce the steps for any additional tables you would like integrated.
It is also a good idea to start FM Chat when your solution launches as part of the startup script. Please watch this video
for the best way to accomplish this.
1. Backup your file.
2. File References.
Add two new file references to your file:
Name the first one "FM Chat" and link it to the file "FMChat.fmp12" then create another one named "FM Chat Go" and link it to the file "FMChat Go.fmp12".
Add a new calculation field to your table (Calculation result is Text):
The calculation for this field should be the data type you are working with in this table for example if this was an invoices table the calculation would just say "invoice" or a purchase orders table would be "Purchase Order". It is not important what goes here it just needs to describe the data type and must be unique. This is used to relate the appropriate chats to your table.
Make sure you check the "Do not store calculation results" checkbox. This option is needed so any records that have already been created will have the value assigned.
4. Table Occurrences.
Select File / Manage / Database and navigate to the Relationships tab where you can see the "relationship graph" for your file. Click the little green plus button in the lower left to create a new occurrence. Select the file "FMChat" as the data source and select the table "System". Name the table occurrence "FMC_SYSTEM" (make sure there are no spaces in the table occurrence name). You can change this name later. This table is a utility table that stores global data. It will only ever need to have one occurrence in your solution.
Now we need to add the chats table to your solution. Click the little green plus button in the lower left to create a new occurrence. Select the file "FMChat" as the data source and select the table "Chats". Name the table occurrence "FMC_CHATS_YourTable" (make sure there are no spaces in the table occurrence and do not replace "YourTable" with anything yet, leave it exactly as shown). You can change this name later.
Staying on the Relationships tab, link Your table occurrence to "FMC_CHATS_YourTable" matching the field "FMC_Type" to "entity_Type" and your table's primary key to "ID_Entity".
Import the scripts from FMChat Integration Example. When importing, just click the check box beside the folder "FMC Scripts Paste Contents Into Your Solution" and all the scripts within that folder will import.
Note: If any scripts are reported as being "renamed" because of a conflict, quickly scan the imported scripts for names ending "2" and correct them.
7. Layouts Part.
Paste the chat portal. Open the file "FMChat Integration Example" and navigate to the layout "Chat Portal". Select all and copy the layout contents. Now navigate to the layout based on the table occurrence we are working with in your solution and paste the contents into the layout. You may need to adjust your layout to make room for the portal. It might work best to paste the chat portal off to the side until you can make the necessary layout adjustments in your file.
As of this writing there is a bug in filemaker 12 that will prevent conditional formatting from working on pasted objects. To remedy this just enter layout mode double click on the words "Private Chat" in the chat portal to enter the text box (do not edit anything just enter the text box). Now do the same thing on the red "X" delete graphic (there is a little text box covering it). Once both text boxes have been entered you can go back into browse mode and this issue should be resolved.
Edit the script parameters. In layout mode double click on the "New Chat" button text to edit the button. Click on "Specify" and then "Edit" to edit the script parameter. Here you will need to change the parameter data to match your solution's table occurrence.
The parameters are name value pairs i.e. "paramName = paramValue". Make sure to leave the names as they are and just modify the values. You will need to look closely at how these parameters are set up. An example might be ["entityID = " & Events::EVENT ID MATCH FIELD & " ; " &] What you would replace would be "Events::EVENT ID MATCH FIELD" with whatever your primary key field is. Make sure to leave the "entityID = " intact as well as the " ; " at the end of each line otherwise the parameter will not work.
Change out the field values to match your table occurrence. Then make sure to uncomment the calculation by removing "/*" at the beginning and "*/" at the very end. Once complete click "OK" to commit your changes.
Our products are designed so you can integrate them into your own FileMaker solutions yourself following the instructions in our online documentation, and our team is happy to provide any guidance you need at no additional charge. So please don't hesitate to reach out if you get stuck--we can likely get your integration unstuck with a quick phone call or email.
Alternatively, our trained and certified developers can do your integration for you from start to finish. Just pick up our minimum five-hour implementation package and send us your file (more complex integrations may require more time).
We can also help you build custom features in any FileMaker solution that involves one or more of our products, including customized deployments of SeedCode Complete. For these types of projects that involve custom-built features, please get in touch to discuss the details so we can give you an estimate of the cost and timeline.