Any Date, Any Format, Anywhere
With AnyDate, you can take a date (or date/time) written in plain language stored in a text field and convert it to Infusionsoft standard formatting for storage in a date or date/time field, and vice versa. AnyDate works with any text, date, or date/time field in any type of record, including opportunities, orders, and appointments. You can make an adjustment, such as adding one month, to the date or date/time before saving it. When using times, you can convert from one timezone to another.
Use cases
- Reschedule an appointment from an Infusionsoft form or a third party integration
- Combine last purchase date with field timer to reactivate customers who haven’t bought recently
- Format dates and times in multiple formats (including European) for use in emails, texts, and timers
- Change the date of a specific task or appointment from campaign builder
- Retroactively find and store date of last purchase by using Max function on orders
- Set warranty expiration date by adding months or years to purchase date
- Add last date a referral purchased to an affiliate’s record
- Add today’s date to a custom field only if it is blank
How to use it
Post URL
http://theapiguys.com/scripts/pocket-developer/Blocks/AnyDate/
Required Parameters
None |
This plugin does not require any parameters other than the standard contactId and App. If no additional parameters are passed, the newest (latest) subscription will be deactivated immediately. |
date |
This field should contain one of the following:
Note: Only the date will be extracted from date/time values. Also, if you include a supported timezone code in your date value, please make sure it is using all capital letters (unless it’s an identifier), and that it appears as the last item in the date field. This will be overridden by any timezone values in the time or timezone parameters, if supplied. If no timezones are designated, assume that all dates are in Eastern Time as is the standard with Infusionsoft. |
action |
The action to take with the specified contact for the specified webinar. The supported actions are: |
webinar |
The ID of the relevant webinar, found in the URL when you are managing your webinar. Look for “webinar=” and copy the number following it. Not that this is not the same as the Webinar ID that is used to join a webinar. |
absent |
For ‘attendance’ action only. The tag ID that will be applied to the contact if they failed to attend the webinar. |
present |
For ‘attendance’ action only. The tag ID that will be applied to the contact if they attended the webinar. |
to |
The “to” address that should be receiving the e-mail, designated by
Note: The value of the parameter will overwrite the value in the “to” field of the email template that is being sent. |
templateId |
The ID of an existing e-mail template in Infusionsoft. Field values within the template, specifically to, from, cc, and bcc, can be over-written by the to, from, cc, and bcc parameters of this plug-in. |
None |
This plugin does not require any parameters other than the standard contactId and App. If no additional parameters are passed, the newest (latest) subscription will be activated immediately. |
None |
This plugin does not require any parameters other than the standard contactId and App. If no additional parameters are passed, the newest (latest) subscription will be deactivated immediately. |
callName |
The “Call Name” of the API Goal as specified within Campaign Builder. This should be something unique and should have no spaces in it. Note: Note: The “Integration Name” of the API Goal should always be your application name (as used for the appName field) |
from |
|
message |
|
from |
|
message |
|
category |
|
name |
|
contactId |
|
field (Optional if using ‘request’) |
|
contactId |
|
a through z, A through Z |
These are the fields to combine, allowing for a total of 52. Each variable can hold:
|
format |
The format is made up of codes, specified by PHP. (Codes are date sensitive.)
Note:
|
saveTo |
This is the field where the result of the formatted date will be stored, such as Contact.Anniversary, Contact.Birthday, Contact._MyCustomDate or Contact._webinarPrettyDate. Do not put tildes (~) around the name of the field. Note: This parameter is optional if using ‘request’. |
destination |
|
textToSave |
Input one of the following:
|
saveTo |
The name of the field you would like the text copied into, e.g. Contact._NextProject. Do not use tildes (~) around the field name. Note:
|
field1 |
This is field one of two whose value will be the basis for some basic operation.
|
field2 |
This is field two of two whose value will be the basis for some basic operation.
|
operation |
This is the name of the basic operation to be performed on field1 and field2.
|
saveTo |
The destination field for the calculation. |
date |
One of the following:
Note:
|
saveTo |
This is the field where the result of the field combination will be stored, such as _ResultField or Contact._CustomField1. |
field |
This is the field whose value will be modified by the counter action, such as _MyField or Contact._CustomField1. Field name should have no merge-field tilde characters. |
direction |
The direction with which the counter should iterate. Possible values are:
|
amount |
The amount of change of the counter iteration. Generally, this should be some positive numeric value, such as 3, 10, 7.6, etc. |
callName |
A unique name for the API call goal you want to trigger. You will also use this in the API call goal setup. |
delayFor |
The number of seconds you want to delay the call for |
saveTo |
This is the field where the result of the timezone lookup will be saved. Fields may be standard (e.g. Contact.Phone) or custom (e.g. Contact._MyCustomField). Do not put tildes (~) around the name of the field. Note: This parameter is optional if using ‘request’. |
App |
Your Infusionsoft application name Note: Your application name can be found in the URL used to access your Infusionsoft account. e.g. http://APPNAME.infusionsoft.com. |
Optional Parameters
collection |
The collection ID. Most often the value of this parameter will be the merge field where the collection id is stored. If the value is empty, a new collection will be created. |
collectionName |
The collection’s human readable name. Defaults to ‘Unnamed Collection’. |
saveCollectionTo |
The field to which the collection ID will be saved. |
saveCollectioNameTo |
The field to which the collection name will be saved. |
saveCollectionLinkTo |
The field to which the collection link will be saved. |
gallery |
The gallery ID. Most often the value of this parameter will be the merge field where the gallery id is stored. If the value is empty, a new gallery will be created. |
galleryName |
The gallery’s human readable name. Defaults to ‘Unnamed Collection’. |
galleryPasswordSaveTo |
Field to which the password will be saved. requires galleryPassword to be set. |
saveGalleryTo |
The field to which the gallery ID will be saved. |
saveGalleryNameTo |
The field to which the collection name will be saved. |
saveGalleryLinkTo |
The field to which the gallery link will be saved. |
permissionMode |
Defaults to ‘everyone.’ Other options are ‘permission’ or ‘private.’ |
collectionPassword |
A password to set for the collection. |
collectionPasswordSaveTo |
Field to which the password will be saved. Requires collectionPassword to be set. |
collectionPasswordExpires |
Field to which the password will be saved. requires collectionPassword to be set. |
collectionDownloadType |
Defaults to null, which is view only access. Options are ‘original’ or ‘jpeg’. requires collectionPassword to be set. |
collectionDownloadMax |
Defaults to unlimited. Send any number to set a maximum. Requires collectionPassword and collectionDownloadType to be set. |
saveCollectionPasswordExpiresTo |
Field to which the password expiration date will be saved. requires collectionPassword to be set. |
galleryPassword |
A password to set for the gallery. If none is sent, will inherit from collection. |
galleryPasswordExpires |
Password Expiration date in any readable format. requires galleryPassword to be set. |
galleryDownloadType |
Defaults to null, which is view only access. Options are ‘original’ or ‘jpeg’. requires galleryPassword to be set. |
galleryDownloadMax |
Defaults to unlimited. Send any number to set a maximum. Requires galleryPassword and galleryDownloadType to be set. |
saveGalleryPasswordExpiresTo |
Field to which the password expiration date will be saved. requires galleryPassword to be set. |
suffix |
The suffix you wish to append to the generated output which may be:
|
to |
|
date |
This parameter allows you to set a future date for the next billing date of the subscription. If no date is passed or if the date is in the past, then the subscription’s default next bill date will be used. |
prefix |
The prefix you wish to prepend to the generated output which may be:
|
subscription |
This parameter allows you to select a specific subscription by ID. You may use Advanced Merge Field notation in combination with prefetch in order to locate the ID. |
to |
|
override |
|
request |
|
excludeAlpha |
Set to 1 to generate a number. |
groupName |
|
adjustment |
The “adjustment” field should provide a relative date format string similar to PHP’s strtotime function. Some valid examples of this value are “+5 weeks” or “second month” or “last day of next month” or “yesterday noon”. (For more possible relative formats, see http://php.net/manual/en/datetime.formats.relative.php. |
timezone |
Note: Common Time Zones: United States |
convertToTZ |
|
request |
This is a URL to query at the end of the operation. The merge field {result} can be placed anywhere within the URL to include the result of the operation, allowing you to pass the value to another script. |
filterBy |
Filter by any field in an Opportunity, as follows:
Note:
|
limitTo |
Opportunity filterBy results can be limited by using the values of ‘oldest’/’first’ or ‘newest’/’last’ to limit the result to a single opportunity. |
orderBy |
Used in combination with ‘limitTo,’ this parameter allows you to order the resulting opportunity lookup by the values ‘created’ or ‘updated’. (Default ordering is by last updated timestamp.) |
default |
The default company name for a contact |
location |
This field may contain either:
If this parameter is not present, Time Zone Finder will use the contact’s primary address postal code (and country, if available) to determine the time zone. Note:
|
identifier |
|
time |
This field should contain one of the following:
Note: Only the time will be extracted from date/time values. Also, if you include a supported timezone code in your time value, please make sure it is using all capital letters (unless it’s an identifier), and that it appears as the last item in the time field. This will be overridden by any timezone values in the timezone parameter, if supplied. If no timezones are designated, assume that all times are in Eastern Time as is the standard with Infusionsoft. |
adjustment |
The “adjustment” field should provide a relative date/time format string that complies with the following documentation: http://www.php.net//manual/en/datetime.formats.relative.php. Some valid examples of this value are “+5 weeks” or “second month” or “last day of next month” or “yesterday noon” or “+2 hours” etc |
timezone |
When the date & time fields are not based on Eastern Time, the user may designate the appropriate originating timezone with any of the supported timezone codes/identifiers specified in the “Supported Timezone Codes” section. Note: Timezone abbreviations should always be in all capital letters, unless using identifiers. If no timezone is supplied, it is assumed to be Eastern |
convertToTZ |
In the event that the user would prefer to have a time automatically adjusted to some other timezone, they may supply a timezone code/identifier within this parameter following the same rules that apply to the timezone parameter above. Note: Adjustments made to the date/time with the “adjustment” parameter are made after the timezone conversion is completed. |
saveKeyTo |
|
time |
This value should be of the following:
Note:
|
override |
|
saveTo |
The field where you want to save the password. Enter the field name without tildes, e.g. Contact._MyPassword. Note: If this parameter is not used, the password will be saved to the Contact.Password field. |
special |
Set to 1 if you want to include the following special characters as part of the password: !@#$%^&*() |
extraSpecial |
Set to 1 if you want to include the following extra special characters as part of the password: -_ []{}~`+=,.;:/?| |
length |
Set the number characters you want the password to be. Default is 8. Note: If this parameter is not used, the password will be eight characters long. |
saveTitleTo |
For ‘register’ action. The field to save the Title/Subject of the webinar to. |
saveDateTo |
For ‘register’ action. Field to save the webinar date or date & time to. |
saveJoinUrlTo |
For ‘register’ action. Field to save the registrant’s JoinURL to. |
from |
A “from” address for the outgoing e-mail. Note:
|
cc |
An e-mail, or comma separated list of e-mails, that will receive a carbon copy of the outgoing e-mail. This value can be
|
bcc |
An e-mail, or comma separated list of e-mails, that will receive a blind carbon copy of the outgoing e-mail. This value can be
|
delete |
Set this to “true” if you want Pocket Developer to delete the contact that is created when no contact exists for an email address in to, from, cc or bcc. Default is set to false. Note: Pocket Developer adds a tag (Pocket Developer -> Created by Email Anyone Anytime) to all contacts it creates for the purpose of sending an email. |
subscription |
This parameter allows you to select a specific subscription by ID. You may use Advanced Merge Field notation in combination with prefetch in order to locate the ID. |
date |
This parameter allows you to set a future date for the next billing date of the subscription. If no date is passed or if the date is in the past, then the subscription’s default next bill date will be used. |
subscription |
This parameter allows you to select a specific subscription by ID. You may use Advanced Merge Field notation in combination with prefetch in order to locate the ID. |
Notes
- If the saveTo field is a Date or DateTime field, you MUST use the Infusionsoft date/time format of Ymd\TH:i:s.
- Below is a summary of the most common date and time codes you can use in the format parameter of Any Date, Any Format, Anywhere. Remember they ARE CaSe sEnsItIVe:
DAYS
d – day of the month 2 digits (01-31)
j – day of the month (1-31)
D – 3 letter day (Mon – Sun)
l – full name of day (Monday – Sunday)
N – 1=Monday, 2=Tuesday, etc (1-7)
S – suffix for date (st, nd, rd)
w – 0=Sunday, 1=Monday (0-6)
z – day of the year (1=365)WEEK
W – week of the year (1-52)MONTH
F – Full name of month (January – December)
m – 2 digit month number (01-12)
n – month number (1-12)
M – 3 letter month (Jan – Dec)
t – Days in the month (28-31)
YEAR
L – leap year (0 no, 1 yes)
o – ISO-8601 year number (Ex. 1979, 2006)
Y – four digit year (Ex. 1979, 2006)
y – two digit year (Ex. 79, 06)TIME
a – am or pm
A – AM or PM
B – Swatch Internet time (000 – 999)
g – 12 hour (1-12)
G – 24 hour c (0-23)
h – 2 digit 12 hour (01-12)
H – 2 digit 24 hour (00-23)
i – 2 digit minutes (00-59)
s 0 2 digit seconds (00-59)
T – timezone (Ex: GMT, CST) - Date/Time Adjustments: Assuming date is 09/22/2014 and time is 08:00 and server is using Eastern Time Zone:
+1 day // returns 09/23/2014 08:00
+1 week // returns 09/29/2014 08:00
-17 hours // returns 09/21/2014 15:00
+1 week 2 days 4 hours 2 seconds // returns 10/01/2014 8:38 PM
next Thursday // returns 09/25/2014 00:00
last Monday // returns 09/15/2014 00:00
third Thursday of next month // returns 10/15/2014 00:00 - Supported Timezone Codes: In the event you can’t find a timezone for your region within the list below, you may also use any of the timezone identifiers supplied at this PHP documentation page; some examples of these identifiers are America/New_York, Canada/Atlantic, etc.
United States
Code Timezone, State, or Region Notes
ETUS Eastern Time No exclusions
CTUS Central Time No exclusions
MTUS Mountain Time Excluding Arizona
AZUS Arizona (No DST) No exclusions
PTUS Pacific Time No exclusions
ATUS Alaska Time No exclusions
HTUS Hawaii/Aleutian Time Excluding Honolulu
HONOUS Honolulu No exclusions
Australia
Code Timezone, State, or Region Notes
WTAU Western Australia Time; Western Australia Excluding Eucla
EUAU Eucla, Australia Time; Western Australia No exclusions
NCTAU North Central Australia Time; Northern Territory No exclusions
SCTAU South Central Australia Time; South Australia No exclusions
NETAU North Eastern Australia Time; Queensland No exclusions
SETAU South Eastern Australia Time;
New South Wales, Victoria, and Tasmania No exclusions
New Zealand
Code Timezone, State, or Region Notes
NZ New Zealand Time No exclusions
Europe
Code Timezone, State, or Region Notes
WTEU Western European Time Excluding Iceland
CTEU Central European Time No exclusions
ETEU Eastern European Time No exclusions
ICEEU Iceland (No DST) No exclusions
Canada
Code Timezone, State, or Region Notes
PTCA Pacific Time; Yukon and British Columbia No exclusions
MTCA Mountain Time;
part of Nunavut Northwest Territories,
Alberta, Saskatchewan No exclusions
CTCA Central Time;
part of Nunavut, Manitoba, some of Ontario No exclusions
ETCA Eastern Time;
most of Ontario, Quebec, Baffin Island No exclusions
ATCA Atlantic Time; Nova Scotia, New Brunswisk No exclusions
NTCA Newfoundland Time No exclusions
FAQ
Q. Can’t I do the same thing with PlusThis?
A. PlusThis can only do three things with dates (in the contact record only): humanize a date in one of seven pre-defined formats, add days or months to date and time fields (in the contact record only), and store in a field in the contact record, and calculate the time between two dates. Any Date, Any Format, Anywhere is much more flexible.
Any Date takes any field as input, in any table (e.g. Opportunity, Invoice, Company, Referral, Appointment, etc.) including text (e.g next Thursday or September 13). Any Date can adjust by anything from 1 nanosecond to 100 years. It can adjust up or down. It also can adjust a date or time forward or backward by a value in a field.
Any Date can store the result in any table, even those of contacts other than the one going through the campaign!