Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...



To create a logic step, select Logic as the type, provide a name for the step, and click Ok. No other settings are needed. Once created, the logic step will appear below its parent, and the overall tree structure will re-position accordingly. A small warning icon will appear in the bottom left of the step. This is an alert for empty logic. Any step with empty logic will fail, so the alert is your cue to add logic.

Warning! A newly created logic step needs code!

Click the [Edit Logic] link to add velocity code. A form will display providing a text area for velocity code. The Velocity Code section that follows provides detail on creating complex code.

At a bare minimum, the logic step code must set the value of $result to the name of a child step.

Campaign Logic Step - Logic Editor

The editor will validate the code when the Ok button is clicked. Any errors will display the output from the velocity compiler. Admittedly, the error messages can be vague. However, the most important feedback is the line number. Use the line number to troubleshoot the problem. Google, the UltraCart forums, and the Apache Velocity mailing lists will help solve the problem.


Campaign Logic Step - Velocity Syntax Error Message

A logic step may have as many children as desired. Click the [Add Step] link and add steps as needed. The screen will re-position the steps as each are added.

Tip

Ending a campaign: If you wish to end a campaign at a logic step, simply set the $result variable equal to _ENDCAMPAIGN_
Example, which proceeds to step NextStepName unless the customer has ordered in the last 14 days. If they have, their campaign is over.

Code Block
themeDJango
linenumberstrue
#set($result = 'NextStepName')
#if($customer.hasPurchasedInLastDays(14))
   #set($result = '_ENDCAMPAIGN_')
#end

...

These options are presented when the [Delete] link is clicked for a step.

Please note: if you delete a Logic step containing more than one branch, the branches cannot be shifted up because they would collide. If you wish to keep the branches, move them to different steps before deleting the Logic, and then move them back in the desired order.

Warning Message when deleting a Logic Step with multiple children