i4w_math

Usage:

This module is the automated version of the [i4w_math] shortcode and is designed to allow you to query a contact field in your Infusionsoft application, perform a simple math operation on it and store the result in Infusionsoft.

This module can be called through a ‘Send an http post…’ following a web or order form.This module can be called manually by typing the URL in your browser.

This module can be called through a ‘Send an http post…’ as part of a trigger process, legacy action set or campaign builder sequence.

Parameters:

i4w_math=abc123Specifies the action to perform (see note 1).
field=_FieldName1Specifies the name of the field used to perform the operation.
target=_FieldName2Specifies the name of the field in which to store the results of the operation. If not specified, it defaults to the name provided in “field”.
value=234.50Specifies the value of the second operand in the operation. If the name of a valid Infusionsoft contact field is entered, that value will be used instead.
operation=addSpecifies the math operation to be performed. Valid operations are: add, sub (subtract), div (divide), mul (multiply), pow (power), mod (modulus), sqr (square root), max (maximum), min (minimum).
round=2Specifies the number of decimal digits to round the result of the operation to. If a positive value is provided the rounding will occur after the decimal point, if a negative value is provided the rounding will occur before the decimal point. Halves are always rounded up. (0, which is the default if this parameter is not defined, means any value will be rounded to an integer).
decimals=0Specifies the number of decimals places to store back into Infusionsoft (0, which is the default if this parameter is not defined, means any value will be rounded to an integer).

Example:

1. The value of custom field “_CustomField” will be multiplied by 39.95 and stored back in Infusionsoft with 2 decimal after rounding to the hundredth.

http://www.yoursite.com/?i4w_math=abc123&field=_CustomField&operation=multiply&value=39.95&round=2&decimals=2

2. The value of custom field “_CustomField” will be multiplied by 39.95 and stored back in Infusionsoft with 2 decimal after rounding to the hundredth and store the result in custom field _OtherCustomField.

http://www.yoursite.com/?i4w_math=abc123&field=_CustomField&operation=multiply&value=39.95&round=2&decimals=2&target=_OtherCustomField

Notes:

1) In all examples provided, ‘abc123’ stand for the first six characters of your Infusionsoft API key. These are used to authenticate the request.

2) The new “Campaign Builder” HTTP POST do not automatically send the contact record data for processing. Individual value pairs must now be specified. In this case, the required value pair is either of the following:

Id<=>~Contact.Id~
contactId<=>~Contact.Id~
ContactId<=>~Contact.Id~
Contact0Id<=>~Contact.Id~

3) The format of how the value is stored within Infusionsoft depends upon the contact field type. Decimal Number, Text and Currency fields will have the data stored by Infusionsoft exactly as calculated by this module. However data stored in a Whole Number field type will be rounded up or down automatically by Infusionsoft upon storing the data.