CA Service Management

Expand all | Collapse all

Spel trigger for status

Jump to Best Answer
  • 1.  Spel trigger for status

    Posted 05-03-2018 03:01 PM

    Good afternoon everyone!

    I need to create a trigger for a spel code that should be triggered on all status changes except for the closed status.

    For a specific status, for example for the resolved, I can use the code below:
    169 FILTER( (EVENT("UPDATE")) && ( status{->'RE'} ) ) ;

    Thank you!

  • 2.  Re: Spel trigger for status

    Broadcom Employee
    Posted 05-03-2018 03:14 PM

    Rodrigo, you can try

    169 FILTER( (EVENT("UPDATE")) &&(! ( status{->'RE'} )) ) ;

    Thanks _Chi

  • 3.  Re: Spel trigger for status
    Best Answer

    Posted 05-03-2018 08:00 PM

    I think this is what they’re after.


    10000 FILTER( (EVENT("UPDATE")) && ( status != 'CL' ) );


    Also I changed the trigger sequence to 10000, the ootb triggers use lower numbers. It’s recommended for custom spel to have higher sequence numbers so that they are triggered after the ootb scripts. The one exception is when you want to override a ootb script.

  • 4.  Re: Spel trigger for status

    Posted 05-04-2018 10:35 AM


    That's what I was looking for.
    As the trigger had the "->" I was in doubt if the "!=" would work.

    Thanks for the hint of the sequence.

    Thank you very much!

  • 5.  Re: Spel trigger for status

    Posted 05-04-2018 11:47 AM

    The -> signifies changing to. So your original trigger would be called whenever status is changed to resolved. You can place a value on th left side as well, so it could be like this, { ‘WIP’ -> ‘RE’ } which would only capture the transition from in progress to resolved.

  • 6.  Re: Spel trigger for status

    Posted 05-05-2018 04:25 AM

    sometimes it's hard to predefine correct trigger filter but you always can validate data within the script:

    // trigger:
    MODIFY cr POST_VALIDATE z_test(status) 1234 FILTER ((EVENT("INSERT")) && (status{}));

    // spel:
    cr::z_test(...) {
         string old_val, new_val;
         old_val = argv[2];
         new_val = argv[3];

         if ((new_val == "CL") && (old_val == "RE")) {
              // do something

    my 2 cents.