03. Push Contacts [7:54]

Description: This video explains the following:

  • How to add, edit, and delete records in FileMaker and push to Outlook
  • Review scripting for adding editing, viewing, and deleting contacts in FileMaker and Outlook


0:00 Hi, in this video, were going to talk about pushing contacts.

0:06 Let’s start with the Beginner Demo. All right, so for contacts push, we’re going to click this button.

0:19 Here we have a simple database with first name, last name, company, email, and then an outlook ID, which will receive after we push this contact.

0:28 So the idea is we can just fill in these simple fields, and then let’s go ahead and insert that into Outlook.

0:34 Okay now it asks us to authenticate Outlook.

0:38 So we can do that back on the setup screen. The Authenticate to Outlook is simply just a way to establish that initial handshake to Outlook, and it only has to be done once per session.

0:50 So once you Authenticate to Outlook, for example, let’s say you open FileMaker and have an opening script that authenticates to Outlook, once that’s done you’ve done your job there, then you can go ahead and do any of the other commands.

1:03 So I’ve just done that now here and the result is 0, so that is success in this case.

1:10 So let’s go back to contacts push and now click insert again, and you can see here we’ve inserted a contact and this is the Outlook ID returned from that contact that we inserted.

1:21 Let’s go take a look at Outlook right now. I’ll go ahead and get that up.

1:26 Note that Outlook could be either open or closed—visibly or invisibly. In other words, if I call this and Outlook happened to be closed, it’ll still attempt to establish communication into Outlook, and then push the data over and do that even though you haven’t already opened Outlook.

1:45 If Outlook happened to be open, the same thing applies. So it’s a neat, flexible feature there.

1:50 Here’s John Smith, we just pushed John Smith, and you can see here AAA Company.

1:56 So if I were to go ahead and push that again, let’s say he had a twin brother named Johnny Smith, and Johnny Smith worked for, let’s see, 123 Test Company.

2:15 Let’s go ahead and set up FileMaker to be on the left side of the screen.

2:17 OK, I’ve now positioned my FileMaker on the left side and my Outlook on the right side, so you have a visual.

2:26 I’m going to go ahead and click insert again, and this time you can see that there’s Johnny
Smith, obviously with a new ID right next to John Smith.

2:35 So before we get much further in some of the other things like editing and deleting, let’s go ahead and take a look at the script that produces that.

2:42 So I’m going to open up the script workspace, and I think I could just put in the word contacts here and then the script is called “enter into Outlook”. So let’s open this up a little wider so it doesn’t fold on itself, and we first perform a script called plug-in checker.

2:58 That’s just like a housekeeping script that just determines if the plug-in installed and so forth.

3:03 You can see here that we attempt to authenticate then we call a command called open folder — this establishes the handshake to which folder we’re talking about. In this case, I’m grabbing the Contacts folder and I’m getting that from the “g” contacts field.

3:20 Then we called the new record command and then we establish all the fields we want to populate within that record. And to get the official names of these fields as Outlook recognizes them, you can get that from the Fields and Functions Guide.

3:35 So essentially we establish which folder, create a new record, set the fields, and then we save the record.

3:41 Once we save the record, it’ll tell Outlook to go ahead and populate that with a new record.

3:47 If we received an error, which is indicated by this particular symbol here– not symbol, but the string which is !!Error!!, and so forth.

3:59 If it had an !!Error!!, we would produce that as a custom dialogue, which could show an error, such as, maybe we had a character string that was too long, maybe we called the commands in the wrong order, meaning that we didn’t call new record command, but we called save record without calling the new record command.

4:15 Anything that went wrong would show there, otherwise it’ll just be successful.

4:21 Now note that we put all of this in a variable, so that if you’re debugging this — which we’ll do in a second — you’ll be able to see each result whether it is successful or not, as it’s happening.

4:33 And then we put here the “g” contact’s Outlook ID, which is the same field as is indicated over here. When this save record is called it actually returns the ID on the Outlook record.

4:45 Why is that important? It’s really important when we go to edit it.

4:58 So let’s look at the edit command. Let’s take this same guy Johnny and let’s just say that he’s changed his first name to Harry. Harry Smith is also at the same company.

5:01 Now let’s go ahead and edit that contact. Now Johnny is changed to Harry and of course it resorted it, but that’s how you edit it.

5:11 Let’s go take a look at what that looks like on the edit script.

5:14 So if I look under my contacts, edit in Outlook. You know these scripts are very similar on how they are designed.

5:20 But let’s go see the subtle differences between the edit and the new.

5:24 We do the same thing, we do the plug-in checker, we authenticate, and then we open the record, which is different. Before, if you recall, we opened the folder.

5:33 This time we open the record, because we have an actual record ID, which is this. So opening the record we don’t have to specify which module, we could just open it by ID.

5:44 We do the same thing set, set, set, set, and save. All of this is identical.

5:49 And then, again, we look for an error and move on.

5:53 So that’s how that works. That is the edit, now the delete, might as well stay here for that.

5:58 Let’s look at delete. Contacts, delete individual. It is actually even easier to do the same housekeeping scripts and then we call the delete record command, and we give it the Outlook ID.

6:13 Then it either works or doesn’t. So let’s go ahead and call the delete record command. Again, this is going to be Harry Smith with this ID. I’m going to go ahead and delete it.

6:23 Harry Smith has now been deleted.

6:27 And then if we wanted to view it, we’d be able to view it. Now, of course, we already deleted that one, so we’re not going to be able to view it. But let’s go ahead and click the view button anyway.

6:36 We should get an error. And here is our error—You cannot display a record that doesn’t have an Outlook ID.

6:41 Alright, let’s take a look at how this view contact in Outlook works.

6:45 Let’s go ahead and create a new contact

6:56 And let’s go ahead and insert that—there’s Fred Flintstone– and now let’s view that contact. And, there, Fred comes right up with this view command, and that’s a neat little command here.

7:09 Display. Okay, we can put in the command display. And in this case, it just says: OK, if there is an Outlook ID continue forward and then we simply call the open record command and give it the ID, and we tell it to display that and you can look at all these commands in great detail. That’s a great feature to be able to view the contact that you just created.

7:32 Alright, and I think that concludes our pushed contacts from FileMaker.

7:39 To learn more, contact us at sales@productivecomputing.com or visit our web site www.Productivecomputing.com. Thank you for watching!