CA Service Management

  • 1.  How to determine if POST_CI trigger fired for UPDATE or INSERT

    Posted Sep 14, 2017 07:06 PM

    I have some spel code that is fired by a POST_CI trigger and I want it to take slightly different actions depending on whether the record it is fired on has just been inserted or if it is an older one being updated.

     

    When I've done this with other trigger types I have been able to pass one of the key fields (e.g. persistent_id) as a parameter and the "previous" value of that parameter (e.g. argv[2] rather than argv[3]) has been null, but that doesn't seem to be working in a POST_CI trigger.

     

    Using r12.6.

     

     

    Help, please.



  • 2.  Re: How to determine if POST_CI trigger fired for UPDATE or INSERT

    Posted Sep 15, 2017 02:36 AM

    HI,

    if this is just to know  update vs. insert, you may want to just use the event state in a if statement  like below:

    if(EVENT == "UPDATE"){

    #this is an update}

    if{EVENT == "INSERT"}{

    #this is an insert

    }

    My 2 cents

    /J



  • 3.  Re: How to determine if POST_CI trigger fired for UPDATE or INSERT
    Best Answer

    Posted Sep 15, 2017 02:38 AM

    little correction, as event is a function not a variable, correct syntax would be:

    (upcase(event()) == "INSERT")


  • 4.  Re: How to determine if POST_CI trigger fired for UPDATE or INSERT

    Posted Sep 18, 2017 02:49 AM

    True thanks cdtj Champion to correct me

    This is what is going when you responding fast from mobile

    /J



  • 5.  Re: How to determine if POST_CI trigger fired for UPDATE or INSERT

    Posted Sep 15, 2017 02:39 AM

    Why don't you put 2 triggers in place - one for UPDATE and one for INSERT ? This way there is no confusion. Internally, you could call the same method (since you're in POST_CI, the object context is gone anyway), but with different parameters.