Notifications - Information from another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 09:44 AM
Hi all,
I have created a notification that approver will get the notification whenever the record is inserted
but the problem is I need some data from another custom table which is extended from task table
NOTIFICATION:
When to send : when record is inserted
who will receive : approver
Table : sysapproval_approver
what it contains : Should contain fields from another table
Is there any solution for this......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 10:28 AM
Hello Rajendra,
You can configure email script for this.
You need data from another custom table that is extended from the task table in your notification, you will need to join the two tables in your query. You can do this by using a GlideRecord to query the task table and then use the addJoin() method to join the custom table to the query.
Refer below pseudocode:
var gr = new GlideRecord('task');
gr.addQuery('active', true);
gr.addJoin('custom_table_name', 'custom_table_name.task', 'task.sys_id');
gr.query();
while (gr.next()) {
var custom_field_value = gr.custom_table_name.custom_field;
// Do something with the custom field value
}
In this example, the GlideRecord is querying the task table for active records, and then joining the custom table named 'custom_table_name' on the 'task' field. Once the query is executed, you can use the dot notation to access fields from the custom table.
Regards
Prasad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 12:30 PM
Hi @Rajendra0823 ,
You can do it using Email Scripts
To trigger email script from notification : ${mail_script:scriptName} //Give your script name
In the Email Script code as below
var abc=" ";
var gr = new GlideRecord('custom table name');
gr.addQuery('columnName', 'columnValue');
gr.query();
while (gr.next()) { //If or while depending on your query
abc= gr.column_name;
}
template.print("This is abc" +abc); //This will be printed in the mail.
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.