Event Action condition setup | IFS Community

Event Action condition setup

  • 21 October 2020
  • 5 replies

Userlevel 6
Badge +16


I’m attempting to trigger a Streams notice on a failed background job. I’ve gotten the event to trigger, however, I am trying to further filter notification by adding a condition for the event based on the site the error occurred at. I’ve noticed that in the Argument field, the actual site name is contained and I thought that I could use wildcards to trigger when that value is present. However, it appears I do not have it configured correctly. I was attempting to use the LIKE condition with wildcards, and I also attempted to use the “=” condition with no luck. The syntax used for both is below:



The argument field contain a long string of text, but the contract site does appear in the string. I’m hoping that I’m using the condition and wildcards incorrectly. Any help would be greatly appreciated. 


Best answer by cjohnson 18 November 2020, 13:48

View original

5 replies

Userlevel 5
Badge +9

The tricky part here is extracting the relevant data from the argument string and what you can do in the event action condition is pretty limited.


My suggestion would be to utilise a PLSQL event action instead to drive the stream notification.  You still have the background job’s argument substitution field that you can use to condition the event action but you will be doing this in code form.  To extract the data from the argument field use the following.


attr_ := ‘&NEW:ARGUMENT’

site_ := Client_SYS.Get_Item_Value('CONTRACT', attr_);


Then you would construct an IF statement using the site_ variable to drive the condition and within the IF statement you would invoke the code to generate the stream notification.

Userlevel 6
Badge +14

I don’t think Client_SYS.Get_Item_Value would work as it isn’t split by characters as such in this case.

You could add a custom attribute on the event with the following code:


(Not the neatest of code I know!)


And then in the event action condition use the custom attribute and just put your site in you wish the event to trigger on.



REGEXP_REPLACE - strips non printable characters and replaces with semi colon

The rest of the code looks where the location where text CONTRACT is found and uses this as the starting position (+1 as skips over the ;)

Then find the next ; after the site to find the end of the site name and use this to get the site from the string.


P.s. I haven’t tested the full solution, only that the substr and instr are correct

Userlevel 7
Badge +16

We use something like this. You’ll need to set up an HTML mail sender in IFS Connect.

In addition to a list of IT users, this copies the user who triggered the error.

I changed the CSS here because it had our company brand fonts and colors. You might want to play with those.


Logical unit AbcClass
Event only when STATE is changed
New values for these:

Event Action
Only when NEW:STATE = Error
Execute Online SQL


subject_ VARCHAR2(32767);
body_ VARCHAR2(32767);
to_ VARCHAR2(32767);
arguments_table_ VARCHAR2(32767);
subject_ := 'Background Job Error in #DB_SID# Database';

arguments_table_ := '<table>'
|| '<tr><th>Argument</th><th>Value</th></tr>'
|| '<tr><td>' || REPLACE(
CHR(30), '</td></tr><tr><td>')
|| '</td><td></td></tr></table>';
arguments_table_ := REPLACE(arguments_table_, '<tr><td></td><td></td></tr>', NULL);
arguments_table_ := REPLACE(arguments_table_, '<table><tr><th>Argument</th><th>Value</th></tr></table>', NULL);
body_ :=
'<!DOCTYPE html>'
|| '<html lang="en">'
|| '<head>'
|| '<style>'
|| 'body {'
|| ' font-family: Calibri;'
|| ' font-size: 15px;'
|| ' color: rgb(51, 51, 51);'
|| '}'
|| 'h1 {'
|| ' font-family: Times New Roman;'
|| ' color: rgb(135, 62, 141);'
|| ' font-weight: normal;'
|| ' font-size: 24px;'
|| '}'
|| 'h2 {'
|| ' font-family: Calibri;'
|| ' color: rgb(51, 51, 51);'
|| ' font-weight: normal;'
|| ' font-size: 24px;'
|| '}'
|| 'th {'
|| ' font-family: Times New Roman;'
|| ' color: rgb(135, 62, 141);'
|| ' font-weight: normal;'
|| ' text-align:left;'
|| ' background-color: #F0F0F0;'
|| '}'
|| 'pre {'
|| ' font-size: 14px;'
|| ' font-family: Consolas, Lucida Console, Courier New;'
|| ' color: rgb(51, 51, 51);'
|| ' font-weight: normal;'
|| '}'
|| 'th, td {'
|| ' font-size: 14px;'
|| ' padding: 0px;'
|| ' border:1px solid black;'
|| ' padding-left: 5px;'
|| ' padding-right: 5px;'
|| ' padding-top: 2px;'
|| ' padding-bottom: 1px;'
|| '}'
|| 'table {'
|| ' border-collapse: collapse;'
|| '}'
|| '</style>'
|| '</head>'
|| '<body>'
|| '<h1>Background Job Errored</h1>'
|| 'Hi,<br />'
|| 'The following background job errored:<br />'
|| '<table>'
|| '<tr><th>Background Job ID</th><td>&NEW:ID</td></tr>'
|| '<tr><th>Description</th><td>' || REPLACE(HTF.ESCAPE_SC('&NEW:DESCRIPTION'), CHR(10), '<br />') || '</td></tr>'
|| '<tr><th>Error Text</th><td><pre>&NEW:ERROR_TEXT</pre></td></tr>'
|| '<tr><th>Arguments</th><td>' || arguments_table_ || '</td></tr>'
|| '<tr><th>Procedure Name</th><td><pre>&NEW:PROCEDURE_NAME</pre></td></tr>'
|| '<tr><th>User</th><td>&NEW:USERNAME</td></tr>'
|| '</table><br />'
|| 'Best regards,<br />'
|| 'IT Team<br />'
|| '<br />'
|| '<i>This email was automatically generated.</i>'
|| '</body>'
|| '</html>';
from_user_name_ => 'IFSAPP',
to_user_name_ => to_,
text_ => body_,
subject_ => subject_,
mail_sender_ => 'MAIL_SENDER_HTML');


Userlevel 5
Badge +11

I’ve recently setup email alerts For background job errors via a custom event which do the trick for me. Let me know if you need help

Userlevel 6
Badge +16

UPDATE - We ended up going at this a different way. We’re using the WADACO system in IFS Apps 10. By using the handheld scanner we can take advantage of the Data Collection Sessions in IFS. I’ve configured Event Actions and split them according to site. This also allows me to pull the error message out for the receive shop order.