Display Email Log in a related list

Victor Ruiz
Tera Guru

How can I Display Email Log in a related list on INC?

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

The sys_email table uses a Document ID field(s) to relate back to records, not a direct relationship.   So you will need to create a user defined related list:


Creating Defined Related Lists - ServiceNow Wiki


1. Go to System Definition\Relationships and click New


2. Name what you want to call this related list in the Name field- example "Email Log"


3. In applies to table choose incident - or if you want this to all tasks you can choose task


4. In queries from table choose Email


5. In the query with script field, paste in:


(function refineQuery(current, parent) {



      current.addQuery("target_table", parent.sys_class_name);


      current.addQuery("instance", parent.sys_id);



})(current, parent);


6. Click Submit.


7. Go to your incident form, configure related lists, and add "Email Log" or whatever you called the relationship in step 2 above.


View solution in original post

10 REPLIES 10

Hi Sairam,

 

If you're using the same conditions:

current.addQuery("target_table", parent.sys_class_name);

current.addQuery("instance", parent.sys_id);

 

Check to make sure that 'target_table' and 'instance' on the incoming received email record are being set to the target record you are currently viewing. If that is all correct, then you might want to check permissions (ACLs) on the sys_email table to be sure users have rights to read the received email records.

 

 

Good luck,

-Brian