CA Service Management

 View Only
  • 1.  Spell from v12.1 doesn't work on v14.1

    Posted Jun 02, 2016 09:04 AM

    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");

      }

    }

    }



  • 2.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 06, 2016 03:16 AM

    Hello Fabian,

     

    I'm make no attempt to debug that code - I'll leave that to others.

     

    But a basic question:

     

    • What does the default logging show at the time? Any errors?
    • Consider turning up "pdm_logstat" logging on the processes.

     

    Thanks, Kyle_R.



  • 3.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 06, 2016 10:47 AM

    Hello Fabian,

     

    Seeing this case, I have a question:

     

    Do not work the event insert filter or not work the code?

     

     

    If I take the statement trigger and put only one function logf, this work fine.

     

    If you use this code in a multi-tenant it will not work.

     

    Best Regards

    Francisco Avendaño



  • 4.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 06, 2016 11:13 AM

    Hi Francisco, thanks for your help. The trigger works. I think some msg[x] variable is returning a null value or something like that only when the filter event is INSERT. If a change the INSERT for UPDATE the zvenciniento is saved without problems. 



  • 5.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 07, 2016 12:14 AM

    Francisco, in this code:

      atsla_domset = msg[0];

      c = msg[1]; // msg[1] = to 0, so the next if statement will be false.

       if (c > 0) { // this is false.

     

    why this value on the previous send_wait function returns 0?



  • 6.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 06, 2016 08:29 PM

    This may or may not help, but...

    In 12.1 I used to create an attached event like this (this is for a Classic workflow task, obviously, but the same applies for other objects):

       send_wait(0, top_object(), "call_attr", "evt", "new_attached_event", (object)NULL,

                 format("wf:%d",wf_id), event_sym, (duration) delay_sec,

                 (date) NULL, event_group_id , 0, 0);

     

    ...and in 12.6+ the above call fails to create an event - there is a new required timezone parameter:

     

       send_wait(0, top_object(), "call_attr", "evt", "new_attached_event", (object)NULL,

                 format("wf:%d",wf_id), event_sym, (duration) delay_sec,

                 (date) NULL, event_group_id , 0, 0, "GMT+0800 (2)");

     

    ...so I am wondering if your issue may be that your new event doesn't have the timezone set?

     

    Regards,

    James



  • 7.  Re: Spell from v12.1 doesn't work on v14.1
    Best Answer

    Posted Jun 07, 2016 02:46 AM

    without debugging and from your last comments this appears that there is no record returned from your send_wait on INSERT mostly because your record don't exist yet.

    I see you use a really low sequence number (30) in your trigger that may explain if the CA trigger to attach the events don't have fire yet.

    Give it a try with an higher number in you sequence like 10000 or higher to see if this is the problem.

     

    You can also check the orders running bop_sinfo -t cr in your command line.

    Running this on a 14.1 instance I can see that SLA related triggers  cr::attached_sla_processing and cr::service_target_processing have sequence 1000 and 1001

     

    My quick 2 cents

    /J



  • 8.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 07, 2016 08:13 AM

    Thanks JEROME, i changed the sequence of the trigger to 1050 and works....



  • 9.  Re: Spell from v12.1 doesn't work on v14.1

    Posted Jun 07, 2016 08:46 AM

    Glad to know that your problem is fix