How do I use non_NX_NTF attributes in a custom notification method

Document ID : KB000029837
Last Modified Date : 14/02/2018
Show Technical Document Details

Not all the ticket attributes will be generated as NX_NTF variables and written into the temp file when using a custom notification method. The following is a work around to access those non-NX_NTF attributes at run time.

When you check the 'Write to file' option of a notification method, you can get many attributes of the ticket from a temporary file and use them in your custom notification method.

However, not all attributes are available from the temporary file. 

For example, you may have 2 custom fields z_from_addr, z_reply_addr in the tenant object to store the “From” and “Reply” email addresses for each tenant. You may want to use these when sending notifications.

However, the temp file of the notification method only has 3 sections: the ticket object, contact object, and the notification. It will not contain the attributes of the tenant object.

A workaround is to add those non-NX_NTF attributes into the message template:

@{call_req_id.<your custom attribute>}

You can then can access the non NX_NTF variables in your custom notification method at run time using the following method:

The idea is based on the fact that any available attribute in a message template will be parsed into its true value in the message body at run time, and the message body will always be written into the temporary file under the notification section.

Therefore, if you want to access any attributes related to the ticket at run time, you can add them into the message template.

For example, if you have one line in message template:


And the z_from_addr field of ticket’s tenant has value

You will find a line in the temp file of the notification method at run time:


The following is an example of how to use 2 custom fields to send a notification:

The example assumes that you have 2 custom fields added to the ca_tenant table (z_from_addr, z_reply_addr), and they should contain values of From email address and Reply email address.


1.  Add 2 lines in the message template:




2. Create a New notification method using the my_mail.bat file with the following contents:

rem my_mail.bat start

rem to avoid multi-thread conflict, will use the same temp filename of the notification

rem save my_mail.bat temp file *.out under windows temp folder

Set tmpname=%NX_NTF_FILENAME%.out

rem get the value of Z_FROM_ADDR

findstr Z_FROM_ADDR %NX_NTF_FILENAME% > %tmpname%

for /F "tokens=2 delims==" %%i in (%tmpname%) do set FROMADDR=%%i

rem get the value of Z_REPLY_ADDR

findstr Z_REPLY_ADDR %NX_NTF_FILENAME% > %tmpname%

for /F "tokens=2 delims==" %%i in (%tmpname%) do set REPLYADDR=%%i

rem enable echo multi-lines in NX_NTF_MESSAGE

setlocal EnableDelayedExpansion

echo !NX_NTF_MESSAGE! > %tmpname%

rem customize message body if necessary

rem for example: remove the Z_REPLY_ADDR/Z_FROM_ADDR variables line

findstr -v Z_REPLY_ADDR %tmpname% > %tmpname%1

findstr -v Z_FROM_ADDR  %tmpname%1 > %tmpname%

rem send the notification

type %tmpname%|pdm_mail -i -m -F %FROMADDR% -T %REPLYADDR% -e %NX_NTF_EMAIL_ADDRESS% -s "%NX_NTF_SUMMARY%"

rem my_mail.bat end


 3. Send a notification from a ticket using your new notification method and verify that the above attributes have been parsed into their actual value.