Import set notification

Manu143
Tera Contributor

Hi Everyone,

 

  I have to send the email notification using email script in table format for that I need to first query the sys_import_set table to fetch the number field and on the basis of this fetched number need to query  sys_import_set_run table to fetch all the related list fields like state,process,updated,ignored,error,comments etc.

 

I need urgent help on this.

 

Thanks,

Manu 

4 REPLIES 4

Hemant Goldar
Mega Sage
Mega Sage

Hi @Manu143,

 

Please find the below example of the email script.

Use as per use case

 

email Script:

var tas = new GlideRecord("sys_import_set");
tas.addQuery('state',3);// condition
tas.query();
if (tas.hasNext()) {
template.print('<br />');
template.print('<table style="height: 23px;" width="100%"><tbody><tr><td style="background-color: #0e5399;"><font color="#FFFFFF"><strong>Import set report :</strong></font></td></tr></tbody></table>');
var tb2 = '<table style="height: 293px;" width="100%"><tbody>';


var tab2 = '<table style="width: 100%; border-collapse : collapse; " border = "2" cellpadding = "10"> <tbody>' + '<tr>' +

'<td style="background-color: #aeaeae;">' + '<b>State</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Process</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Updated</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Ignore</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>error</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>comments</b>' + '</td>' +

'</tr>';
template.print(tab2);
}

while (tas.next()) {

var clsed2 = '<tr>' +
'<td>' + tas.state + '</td>' +
'<td>' + tas.process + '</td>'
'<td>' + tas.updated + '</td>'
'<td>' + tas.ignore + '</td>'
'<td>' + tas.error + '</td>'
'<td>' + tas.comments + '</td>'
'</tr>';
template.print(clsed2);

var tab_end2 = '</tbody> </table>';
template.print(tab_end2);

 

I hope this helps!

 

Regards,

Hemant 

**Please mark my answer correct or helpful based on the impact**

@Manu143, Please mark my previous response as the correct answer to close the thread.

 

Thanks,

Hemant

 

Hi Hemant,

  May I know how to query the colum  with the name Number as there will not be any condition? and what will be the condition for notification ?'

 

 

Thanks,

Manu

@Manu143 without condition it will through all the records from the sys_import_set table.

I will suggest putting some simple conditions like those created today..

 

You can create a schedule and trigger a notification through eventQueue method.

Below is the article which will help you to create a schedule notification.

Fire an email notification from a schedule job 

 

I hope this helps!

 

Regards,

Hemant 

**Please mark my answer correct or helpful based on the impact**