Custom trigger

Hi Team,

I want to wirte a trigger which will make a custom field work in such a way that if the sla of any of the incident breaches than the field will hold the value "YES" else the value will be "NO"

In short,

if sla.breach is 'true' then my custom field will get auto updated to "YES"

if sla.breach is 'false' then my custom field will get auto updated to "NO"

If have used fc/javascript, the value is getting updated at the form level but it is not getting saved in the database. Can anyone please help me out in writting a trigger which can update the database with the value "YES" or "NO" based on the above stated condition.

Thanks and regards,

Sanjeev

  • I was just about to do myself the same thing, as the report displays false or true, which is not informative for the user.

    1) first method, set the desired value in the same place where you set the value of the "sla.breach"

     

    2) 2nd use triggers

    If use trigger:

    Trigger name = "My.a.u.probsummary"

    - short abbreviation - "My" - may be your company name in short (for example SIEMENS -> SIE or SIEM, ...)

    - a.u. - mean After Update

    - table name

    this naming makes it easy to understand the purpose of a trigger by name (for example: PAN.a.a.incidents.notify - after add incident make notification - email or some other)

    In your case

    trigger name: YOUR.a.u.probsummary.sla

    table name: probsummary (if other then change it to your table)

    trigger type: 4

    Script text:

    if(oldrecord.sla_breach != record.sla_breach && record.sla_breach == true)
    {
    	record.CUSTOMFIELD="YES";
    }

    --

    And in DBDICT for probsummary DataPolicy-Default Value set NO