- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2022 04:47 PM
I'm needing to figure out how to query the Activities on a sc_task to see if the requestor has replied to an email..
Does anyone know a generic script to query the Activities. I think it's the sys_history_set table but that does not seem to have a tie into something else
I have the information in the screen shot but don't know where / how to glideQuery this.
My request from the user is they need to see if the requestor on a SCTASK has responded via email. So I think the OID relates to something and the sys_history_set table the ID is the sys_id of the SCTASK. So I'm confused on what to query. Any help?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 12:36 AM
Hi,
Doing a query on history tables in not a recommended practice I would suggest and can impact your instance performance.
For your requirement, my suggestion here will be to update the ticket field say Work Notes or Additional comments when the user respond back via email.
Navigate to your Inbound action and update the script of Inbound Action as below for example:
current.work_notes = email.subject;
current.update();
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2022 05:18 PM
The activity formatter pulls data from a number of places to display it. The history tables are not populated until you actually try and view the history. So you cannot count on that data being there when you query it.
The best way to find out if a user has sent an email to the system is either to use an inbound action to make what ever the update/change is when the message is received or to query the sys_email table.
Without knowing more on the who/what/why there is not much else I can offer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2022 10:47 PM
Hi,
Please look into this link : https://community.servicenow.com/community?id=community_question&sys_id=fd9a832ddb5cdbc01dcaf3231f96190f
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 12:36 AM
Hi,
Doing a query on history tables in not a recommended practice I would suggest and can impact your instance performance.
For your requirement, my suggestion here will be to update the ticket field say Work Notes or Additional comments when the user respond back via email.
Navigate to your Inbound action and update the script of Inbound Action as below for example:
current.work_notes = email.subject;
current.update();
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2022 10:55 AM
So say I want to put this in the additional comments not the work notes. I tried the following in the inbound email script in the script section
// want to put the subject in the additional comments and show it was updated by the sender.
current.comments = email.subject + ' ' + email.from
current.update();
but nothing happened. how can I correct this
I need these sections of the email
This is the Activity Record
Want the areas in purple in Additional comments not necessarily Work notes because the user would only add additional comments so we need separation of what is put in work notes and additional comments. So here is an example of what I would like to see in the additional comments.