trigger with condition

55 views
Skip to first unread message

Pierdonato Inglese

unread,
Jan 20, 2018, 10:56:42 AM1/20/18
to mementodatabase
Block the execution of a trigger (cancel the event) based on a condition.


Ex:

var e = entry();
var order = e.field("order")[0];
var totalbefore = order.field("total");

if (totalbefore > 10) {
Block trigger execution, display message and cancel event
}

else {
Instruction;
}

Bill Crews

unread,
Jan 20, 2018, 2:34:50 PM1/20/18
to Pierdonato Inglese, mementodatabase
Is there a question here? Read the Triggers wiki page.

On Jan 20, 2018 10:56, "Pierdonato Inglese" <pierdonat...@gmail.com> wrote:
Block the execution of a trigger (cancel the event) based on a condition.


Ex:

var e = entry();
var order = e.field("order")[0];
var totalbefore = order.field("total");

if (totalbefore > 10) {
// Block trigger execution, display message and cancel event
message("Limit exceeded");
cancel();
exit();
}

else {
// Instruction;
message("You don't need the else, because of the exit() call. Just put your logic after the if { }");
}

Reply all
Reply to author
Forward
0 new messages