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

Brian Dailey1
Kilo Sage

HI Victor,



You can add Emails to your list of fields that get displayed in the Activity Formatter by adding it as '*Email*' to the UI property in [sys_properties] for that particular type of task.



i.e., for Incidents:



Name:   glide.ui.incident_activity.fields


Value (ex.): comments,assigned_to,assignment_group,u_category,priority,resolved_by,*Email*,urgency,short_description,state,work_notes




Or, if you actually want it as a separate related list, you can define one by going to System Definition>Relationships:



  1. Create a new relationship.
  2. Set Applies to table: Task [task]
  3. Set Queries from table: Email [sys_email]
  4. Enter the following script in Query with:


current.addQuery('instance=' + parent.sys_id);



Lastly, add this new related list to your form configuration for whatever kind of task you like.





Give either of those a try.




Thanks,


-Brian


Hi, 

 

For this same configuration https://community.servicenow.com/community?id=community_question&sys_id=165f72a9db58dbc01dcaf3231f961984

How to use it for the mobile application.

For example, consider the Cases,

This cases contains Emails in the related list tab( currently we have this functionality in Agent Workspace) how to implement the same functionality for Now agent mobile app. So that the app contains icon for cases and inside the cases we must have the email tab as related list.....

How to configure this using studio......how to implement the related list part...... currently Email is not showing under the related list (relationship), if we search there and destination screen

 

Victor Ruiz
Tera Guru

Thanks a bunch gents.....it worked like a charm.


Alvi1
Kilo Contributor

Hello how can I configure email approval in related list? Will it also be in the System Definition > Relationships? 

Sairam3697
Tera Contributor

Hi , I am only able to see the sent messages. Is there any way to see the received emails as well ?