We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

trigger email notification when an attachment is added to an incident

purushothamN599
Tera Contributor

Hi ,

 

 

Trigger email notification when an attachment is added to an incident working fine but unable send with this body

 

 

1. Attachment by: Person that attached.

2. Attachment Date: [Date/Time]

3. You can view the attachment by clicking the link below.

 

 

4. *[link should take them to the incident.]

 

Purushotham1992_0-1707105047729.png

 

 

 

Event and email Notification created on incident table 

Business rule created on Attachment table 

 

 

Thanks in advance 

1 ACCEPTED SOLUTION

Hello @purushothamN599 ,

 

Use var t = event.parm2 instead of var t=${event.parm2}

View solution in original post

18 REPLIES 18

Hi @siva krishna M2 

 

Getting below error while creating email script

Purushotham1992_0-1707220342472.png

 

 

Thanks in advance 

Hello @purushothamN599 ,

 

Use var t = event.parm2 instead of var t=${event.parm2}

Hi  Expert  @siva krishna M2 ,

 

Thanks for your time and support  , Could you please help me on this 

 

Business rule : 

 

var incAtt = new GlideRecord('incident');
        incAtt.addQuery(current.table_sys_id,incAtt.sys_id);
        incAtt.addEncodedQuery('assigned_to=');
        incAtt.query();
        if (incAtt.next()) {

            var group = incAtt.assignment_group;
           
            if (incAtt.get(current.table_sys_id)) {

   var createB =current.sys_created_on+","+current.sys_created_by;

                gs.eventQueue('incident.attachment.add',current,group,createB);


                }


                }

 

5.You can view the attachment by clicking the link 

 

6  .  *[link should take them to the incident.]

 

Purushotham1992_0-1707221586750.png

 

 

 

 

Thanks in advance

Hello @purushothamN599 ,

 

Is mail script and notification working as expected? If yes, please click on like icon and mark the mail script code as accepted solution.

 

Could you please elaborate your issue

Hi @siva krishna M2  ,

 

Mail script is working fine and please help me on below once

 

5. You can view the attachment by clicking the link 

 

6  .  *[link should take them to the incident.]

 

Purushotham1992_0-1707223266025.png

 

Business rule : 

 

var incAtt = new GlideRecord('incident');
        incAtt.addQuery(current.table_sys_id,incAtt.sys_id);
        incAtt.addEncodedQuery('assigned_to=');
        incAtt.query();
        if (incAtt.next()) {

            var group = incAtt.assignment_group;
           
            if (incAtt.get(current.table_sys_id)) {

   var createB =current.sys_created_on+","+current.sys_created_by;

                gs.eventQueue('incident.attachment.add',current,group,createB);


                }


                }

 

Thanks in advance