How to combine to multiple email scripts on different tables as one email script ?

Community Alums
Not applicable

Hi everyone, 

How can we combine multiple email scripts as one email script for fetching data on email body for different tables.

Scripts:

 var gr = new GlideRecord("cmdb_ci_business_app");
    gr.addQuery('assigned_to.name', event.parm2);
    gr.query();
    while (gr.next()) {
        template.print(gr.number);
        template.print("<br/>");
    }   

 var gr = new GlideRecord("cmdb_ci_service_discovered");
    gr.addQuery('assigned_to.name', event.parm2);
    gr.query();
    while (gr.next()) {
        template.print(gr.number);
        template.print("<br/>");
    }

 

find_real_file.png

Thanks @Ankur Bawiskar , @Mohith Devatte 

1 ACCEPTED SOLUTION

@Venu gopal sr THEN I THINK THIS IS THE ISSUE 

we need to two email scripts in this case 

Reason :

Events and notifications work in such a way that event is on the same table and the notification is on the same table .

So the your notification is on business app table and the event used there is business app so what ever you write in as event.parm1 and event.parm2 it will get  only business app records even if you are glide recording another table and using event.parm2 of its corresponding event it wont catch the value it catches  business app assigned to name only as the notification is on Business app table 

so please have two email scripts in this case 

please mark my answer correct if it helps you and close the thread 

View solution in original post

18 REPLIES 18

palanikumar
Mega Sage

Hi,

Can you share sample output expected.

Thank you,

Palani

Thank you,
Palani

Community Alums
Not applicable

Hi,

the output is as shown in below.

find_real_file.png

 

Thanks

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

if both the email scripts are included in same Email body then you can merge

what's the challenge?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

 If I am merging getting same data.

find_real_file.png