Notifications related list in Incidents and Catalog tasks

Harry Campbell2
Mega Guru

Hi Everyone,

I'm hoping this is simple - I thought it would be simple anyway but couldn't figure it out.

I want to add a list of email notifications to incident and task records so there will be an easy way to see what emails were generated from each record. Rather than having it in the activity formatter.

Could anyone tell me the best way to achieve this?

Regards

Harry

1 ACCEPTED SOLUTION

I think you are not configuring the relationship correctly:



- Applies to table: it should be the table where you want to show the related list (e.g: incident).


- Queries from: the correct table is sys_email.



In the Query script, you have to use parent.number instead of current.number.



Another way to query is to use the instance field from the sys_email table:



(function refineQuery(current, parent) {


      current.addQuery('instance', parent.getValue('sys_id'));


      current.addQuery('type', 'IN', 'received,sent'); // If you want to filter send-ignored email, etc.


})(current, parent);



Hope it helps!


View solution in original post

9 REPLIES 9

paramveer
Mega Guru

How you care creating the relationship ? would be helpful if you provide the screenshot of the same.


Harry Campbell2
Mega Guru

Screenshot of the relationship I have set up:



Capture.PNG



This is whats returned on the related list:



Capture.PNG


I think you are not configuring the relationship correctly:



- Applies to table: it should be the table where you want to show the related list (e.g: incident).


- Queries from: the correct table is sys_email.



In the Query script, you have to use parent.number instead of current.number.



Another way to query is to use the instance field from the sys_email table:



(function refineQuery(current, parent) {


      current.addQuery('instance', parent.getValue('sys_id'));


      current.addQuery('type', 'IN', 'received,sent'); // If you want to filter send-ignored email, etc.


})(current, parent);



Hope it helps!


This worked perfectly. Removed the line that filtered the sent emails and it showed exactly what I need.


paramveer
Mega Guru

Hi harry,



You are querying on wrong table, please query on "sys_email" table instead of "sys_email_log" table. If you just change the Queries from table to "sys_email", it will resolve your problem.



Thanks,


Param