From User List Box to Email
Infusionsoft’s User List Box type field can be handy. If you want to track which staff members are connecting with contacts in particular roles, for instance, you can create a custom field for each role. The User List Box type field will show you a dropdown list of all your Infusionsoft users for easy data entry in the contact record screen or an internal form or webform.
Unfortunately if you want to send automatic email notices to those staff members, the User List Box is basically useless. You’d need to have a separate custom field (in addition to the User List Box) to store the email. For many users, burning up so many custom fields is a problem.
With our Advanced Merge Field Notation, you don’t need to store user data in additional custom fields. You can drill down through the User List Box to get any readable data from the User table.
First, it helps to understand that while the User List Box displays a name, the data it actually contains is the user’s id number. This is the number you would see in the url if you went to edit the user data in Infusionsoft (Admin > Users > click user name). So what we need to do is get the email field for that user id from the User table.
To do so, we’re going to use the parentheses reference notation in Pocket Developer. You can get any specific record from a table by inserting the id number in parentheses after the table name and before the period. For instance:
Contact(12).FirstName
will get the contents of the FirstName field for contact id number 12. Similarly:
User(12).Email
will get the email address of user id number 12. Of course you won’t want to hardcode the id number each time you use Pocket Developer; instead you’ll want to merge in the User List Box field contents like this:
User(~Contact._UserListBox~).Email
You can use this to either temporarily get the email address and put it in an email field (e.g., EmailAddress2) or custom field, adn then send the email out using that field. Or, if you are using the PDev Email Anyone plugin, you can simply enter that text as the value of the “to” parameter:
Conditional operators for Pocket Developer: {if} {then} {else} Notation
Infusionsoft’s Decision Diamonds are fantastic. But sometimes they just aren’t sophisticated enough. You can set up complicated cascading diamonds, but it’s not much fun. So we thought we’d add the ability to do some conditionals in Pocket Developer plugins. To this end, we developed the {if} {then} {else} notation.
Let’s say you want to use AnyText to save something to a custom field, but only if another custom field has a value. For instance, maybe if the contact has a spouse, you want to put the number 2 in the “Number Registered” field. You could create an HTTP Post like this:
You can get more complicated by adding an {else} statement. Let’s in addition to entering a 2 when there’s a SpouseName, you want to enter a 1 if there is no SpouseName, you could make your textToSave value like this:
{if} Contact.SpouseName {then} 2 {else} 1
Remember, if you want to merge in data from a merge field, include the tildes:
{if} Contact.SpouseName {then} This person’s spouse is ~Contact.SpouseName~. {else} This person is not married.
(I’m not really sure why you’d want to do this, but you get the idea.)
Another way to use this conditional notation might be to set a default. For instance, if you are using AnyDate and you have set the date parameter to a field that is empty, the process will fail as a bad request (because you have given it no date input to convert or copy). You can fix this by using {else} to set a default date like this:
{if} Contact._FieldWithDate {then} ~Contact._FieldWithDate~ {else} today
With this value, if there is a date in the FieldWithDate field, it will be saved (to whatever field you designate in the saveTo parameter value), but if there is not date in FieldWithDate, it will set the date in the saveTo field to today’s date.
As always, we recommend thorough testing as you implement these advanced features. If you have any questions or run into any issues, let us know!
Automatically mark a task complete
Using Advanced Merge Field Notation (AMN) with Pocket Developer Any Any Date, Anywhere plugin in an HTTP Post in Campaign Builder, you can automatically mark tasks complete.
In order to mark a task complete, you need to set the CompletionDate field on the ContactAction table complete. (The ContactAction table is where tasks, appointments, and notes are stored. See Working with tasks, appointments, and notes for more details.) Doing so with AnyDate is as simple as setting the saveTo parameter to the value “ContactAction.CompletionDate”. However, this will ONLY work properly if the task you want to mark complete is the most recently created task, appointment, or note.
To reliably mark the correct task complete, we need to first “prefetch” the id number of the task and store it in a variable. We will then insert that variable in parentheses after the table name, so that when Pocket Developer retrieves the table it gets the entry with that specific id number, rather than the most recently created entry.
To start with, we want to tell PDev to get the Id number from the ContactAction table, so set the prefetch value to:
ContactAction.Id
Then we want to filter the table for just tasks that are not complete, so we’re going to use AMN in our prefetch value:
ContactAction.Id.FilterBy(ObjectType:Task,CompletionDate:~null~)
We’ve now targeted the most recently created incomplete task to mark as incomplete. (Well, we need to add that id number in parenthesis in the saveTo value, but more on that later.) This may be enough to reliably target the task to mark complete. But in the event the task we want is older, we can continue to add FilterBy criteria. Let’s say the task always has the Action Description “Feed Unicorns”, we can search for that specific description:
ContactAction.Id.FilterBy(ObjectType:Task,CompletionDate:~null~,
ActionDescription:"Feed Unicorns")
Note that the wildcard % is available, so if the task always starts with “Feed” but might be “Feed Unicorns” or “Feed Vampires”, we can use:
ContactAction.Id.FilterBy(ObjectType:Task,CompletionDate:~null~,
ActionDescription:"Feed %")
to get the most recent of either kind of task.
Once you have filtered for the specific task id, we just need to make sure the task id variable is used in the saveTo value. The variable is labeled in brackets after the “prefetch” name, so the complete prefetch name/value line will look like this:
prefetch[taskid] = ContactAction.Id.FilterBy(ObjectType:Task,CompletionDate:~null~,
ActionDescription:"Feed Unicorns")
The prefetch label can be anything, but must contain some alphabetic characters (i.e., not numbers only) and should have no spaces or special characters. In this case we’ve used “taskid” as a clear label of what the variable contains. We will insert this label in curly braces where we want the variable value to be used. In this case, we want to use it in parentheses after the table name, so as to identify the specific entity to change.
saveTo = ContactAction({taskid}).CompletionDate
We just have to set up the HTTP Post in the campaign where we want the task to be marked complete, and we’re done! Here’s what the HTTP Post looks like in the end:
Working with tasks, appointments, and notes
The Pocket Developer plugins Any Text Anywhere and Any Date, Any Format, Anywhere really do mean anywhere… not just on contact records. But getting access to other record types requires a little bit of know-how.
Accessing information in tasks, appointments, and notes is particularly tricky, because believe it or not these three different entities are all stored in the same data table in Infusionsoft. That means you usually need to specify which type of entity you are looking for. Even so, there’s a good bet that the contact will have more than one of these entities, so you’ll also need to be specific about which one you want to work with.
That’s where our Advanced Merge Field Notation (we just call it AMN) comes in. Let’s break down how to use AMN to get data to (or from) tasks, appointments, and notes.
Power user tips
Infusionsoft stores tasks, appointments, and notes all in the same database table, named ContactAction. (View Infusionsoft’s table schema here.) The first thing you’ll want to know is how the database field relate to each of the three entities.
Database field name | Task | Appointment | Note |
---|---|---|---|
ActionDate | Action Date | Appt Date | – |
ActionDescription | Title or Action Description | Title or Action Description | Title |
ActionType | Action Type | Action Type | Type |
CompletionDate | Completion Date | - | – |
CreationNotes | Description or Creation Notes | Description or Creation Notes | Description |
EndDate | - | Appt End | – |
Location | - | Location | – |
ObjectType | Task | Appointment | Note |
Priority | Priority | Priority | – |
In addition to these visible field, there is one important invisible field called “IsAppointment”. This field is set to 1 if the entity is an appointment, so it is useful for narrowing down items to just appointments.
Another field to know about is the CompletionDate field. This is only relevant to tasks. If there is no date in that field, the appointment will appear in Infusionsoft as incomplete. If you add a date there (e.g., using AnyDate), the task will appear in Infusionsoft as completed.
Also, few people use them but you can in fact add custom fields to tasks, appointments, and notes. The catch is that those custom fields appear for all three of those entities,o if you want a custom field on Appointments, that custom field will also appear on Tasks and Notes. As with all records types, you get 100 custom fields, but that’s across all three entities that get stored on this table.