AnsweredAssumed Answered

Spell from v12.1 doesn't work on v14.1

Question asked by Bassoalto on Jun 2, 2016
Latest reply on Jun 7, 2016 by jmayer

Hi, this is a question about a spell trigger that we used on a 12.1 version. Now we need to move this trigger to 14.1 version, but doesn't work.

 

When the trigger use the UPDATE event to filter (FILTER(EVENT("UPDATE")) ) the code works fine. But doesn't on a INSERT.

 

The objective of this code is to attach an event that contains the violation event to the service type to capture the firstfiretime value and saving it to the zVencimiento field on cr table.

 

Basicly this trigger has the following sentence:

 

MODIFY cr {POST_VALIDATE zaddevtvenc(status) 30 FILTER(EVENT("INSERT"));};

 

And this is the spell code:

 

cr::zaddevtvenc(...) {

if ((status == 'OP')) {

  int c;

  c = 0;

  object atsla_domset;

  string where_clause;

  where_clause = format("_mapped_cr = '%s'", persistent_id);

 

  send_wait(0, top_object(), "call_attr", "attached_sla", "sync_fetch", "MLIST_STATIC", where_clause, -1, 0);

  if (msg_error()) {

  logf(ERROR, "attached_sla _mapped_cr sync_fetch '%s'\n", msg[0]);

  return;

  }

 

  atsla_domset = msg[0];

  c = msg[1];

 

  if (c > 0) {

  string ide;

  string ids;

  object therecord;

  object group_leader;

  object attached_events_table_record;

 

  send_wait(0, top_object(), "get_co_group");

  if (msg_error()) {

  logf(ERROR, "%s - %s", ref_num, msg[0]);

  return;

  }

  group_leader = msg[0];

 

  send_wait(0, atsla_domset, "dob_by_index","DEFAULT", 0, 0);

  therecord = msg[0];

 

  send_wait(0, therecord, "get_attr_vals",2,"map_sdsc.id","map_sdsc.zEventoVencimiento");

  ids = msg[3];

  ide = msg[6];

 

  send_wait(0, top_object(), "call_attr", "atev", "get_new_dob", NULL, NULL, group_leader);

  if (msg_error()) {

  logf(ERROR, "%s - %s", ref_num, msg[0]);

  return;

  }

 

  attached_events_table_record = msg[0];

  attached_events_table_record.obj_id = persistent_id;

  attached_events_table_record.event_tmpl = ide;

  attached_events_table_record.group_name = "SLA";

  attached_events_table_record.owning_ast = "ids";

 

  send_wait(0, group_leader, "checkin");

  if (msg_error()) {

  logf(ERROR, "%s - %s", ref_num, msg[0]);

  return;

  }

  send_wait(0, group_leader, "checkout", therecord);

  if (msg_error()) {

  logf(ERROR, "%s - %s", ref_num, msg[0]);

  return;

  }

zVencimiento = attached_events_table_record.first_fire_time;

logf(SIGNIFICANT, "zVencimiento");

  }

}

}

Outcomes