hi,
code described 2 post upper is using "cancel_me" method and works for any kind of attached avents.
You can create spl file in your mods/majic directory, then place this code into it:
int atev::z_cnclme_by_persid(string atev_persid) {
object gl, atev;
send_wait(0, top_object(), "call_attr", "atev", "dob_by_persid", 0, atev_persid);
if (msg_error()) {
logf(SIGNIFICANT, "Error : %s", msg[0]);
return 0;
}
atev = msg[0];
send_wait(0, top_object(), "get_co_group");
if (msg_error()) {
logf(SIGNIFICANT, "Error : %s", msg[0]);
return 0;
}
gl = msg[0];
send_wait(0, gl, "checkout", atev);
if (msg_error()) {
logf(SIGNIFICANT, "Error : %s", msg[0]);
return 0;
}
send_wait(0, atev, "cancel_me");
if (msg_error()) {
logf(SIGNIFICANT, "Error : %s", msg[0]);
return 0;
}
send_wait(0, gl, "checkin");
if (msg_error()) {
logf(SIGNIFICANT, "Error : %s", msg[0]);
send_wait(0, gl, "uncheck");
return 0;
} else {
// logf(SIGNIFICANT, "[%s] canceled", atev.persistent_id);
return 1;
}
}
this function will cancel event by its persid,
then add to your Action Macro this code:
if (atev::z_cnclme_by_persid(attached_event.persistent_id)) {
logf(SIGNIFICANT, "[%s] canceled successfuly for [%s].", attached_event.persistent_id, persistent_id);
} else {
logf(SIGNIFICANT, "[%s] for [%s] cannot be canceled.", attached_event.persistent_id, persistent_id);
}
this code is valid for every Action Macro that executes by Attached Events.
More information about attached events could be found in this doc : SPEL EVENT methods
Regards,
cdtj