Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2012 12:05
Show Gist options
  • Select an option

  • Save anonymous/4267272 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/4267272 to your computer and use it in GitHub Desktop.
// This is the data being used inside the rule. This can come from anywhere.
{
averagePriceSold: "12.10",
numberOfVisitors: 1000
}
// This is a (Pseudo code) function being called from inside the rule, when all rules evaluate to TRUE.
saveValue: function(data) {
sendEmail("Value too low", data);
Dashboard.add.warning("Value too low");
}
singleRule = {
conditions: {
all: // All validations should pass like AND (other value is 'Any', like OR )
[
{
name: "averagePriceSold", // Parameter to check
operator: "lessThan", // Operator
value: "15.15" // Value
},
{
name: "numberOfVisitors",
operator: "higherThan",
value: "1100"
}
]},
actions: [
{
name: "price", // Action Name
value: "saveValue", // Action to perform (is a function)
fields: [
{
name: "averageSalesPrice", // Pass these fields to the action (Function arguments)
value: "too low"
}
]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment