Highlighted
New Member.
133 views

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

=========================================================================================
Old account: SanjeevDas
0 Likes
1 Reply
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Custom trigger

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

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.