Inbound Email reply issue in target table

Anjaneyulu1
Giga Contributor

Hii All,

I Have an issue regarding Inbound Email Reply in target table.

It is not showing Incident Number in target. 

find_real_file.png

here is my inbound email action

find_real_file.png

1 ACCEPTED SOLUTION

Hi @Anjaneyulu Nalamothu 

 

As per your requirement, I made some changes.

Because of Watermark, your target table is not coming.

 

Updated email script:

var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', current.assignment_group);
gr.query();
while (gr.next()) {
  var gm = gr.user.user_name.toString();
  var baseLink = gs.getProperty('instance_name') + '@servicenowdevelopers.com';
  var app = '<a href="mailto:' + baseLink + '?subject=re: ' + gm + ' - assigned&body='+email.getWatermark()+' This Incident is Assigned to - ' + gm + '">Assigned</a><br><br>';
//email.getWatermark()
  template.print(gm + ' - ' + app);
}

 

If my response is helpful, then Please mark as Correct Answer/Helpful.

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

View solution in original post

10 REPLIES 10

@Anjaneyulu Nalamothu 

I have been away for past couple of days and did not got a chance to look into your query.

Approach:

From the description above I have got an idea on what you are trying to achieve here. So suggestion here would be to implement it similar to how Approval and Reject Email templates work OOB in ServiceNow

Below are steps to achieve your requirement:

1) Navigate to the module Email Template and click on New button.

2) Now within the Email Template you can write your Email Script by using the tags as shown below:

<mail_script>

your code here to generate group Members here

</mail_script>

For reference you can have a look how Approval works as per links below:

https://instance.service-now.com/nav_to.do?uri=sysevent_email_template.do?sys_id=c2dee61cc611227601f80c0ea98f9a3f


Replace "instance' with your instance name.

Now call your New Email template in your Notification as per syntax below:

${mailto:Email Template Name}

Refer the doc below:

https://docs.servicenow.com/bundle/rome-servicenow-platform/page/integrate/email-integrations/reference/r_ConstructAnEmailMessage.html

Now the next and final step will be to write your Inbound Action similar to how OOB Approval works . Please refer the link below:

https://instance.service-now.com/nav_to.do?uri=sysevent_in_email_action.do?sys_id=b43ef438c611227100a9aa83fe121dda

Replace "instance' with your instance name.

So this will reduce the complexity of checking the Body content of email coming and when some one clicks on the Assignee link it will populate the name of that person only and you can check for that instead of iterating through the entire body content.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Did you add the Log statement to check whether it is entering inside the IF loop or not?

 

Regards,

Bhavana

Hi @Bhavana Reddy ,

as you said i have given log statement also.

But still incident number is not coming in target field in email logs.

please help me in it once.

 

 

It would be very hard to check by looking at it and if you are okay, we can connect via Zoom

below is my email address, send me the zoom link to join i am free now 

bhavanareddy.sai.15121994@gmail.com

Hi @Anjaneyulu Nalamothu 

 

As per your requirement, I made some changes.

Because of Watermark, your target table is not coming.

 

Updated email script:

var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', current.assignment_group);
gr.query();
while (gr.next()) {
  var gm = gr.user.user_name.toString();
  var baseLink = gs.getProperty('instance_name') + '@servicenowdevelopers.com';
  var app = '<a href="mailto:' + baseLink + '?subject=re: ' + gm + ' - assigned&body='+email.getWatermark()+' This Incident is Assigned to - ' + gm + '">Assigned</a><br><br>';
//email.getWatermark()
  template.print(gm + ' - ' + app);
}

 

If my response is helpful, then Please mark as Correct Answer/Helpful.

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂