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!