- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:29 AM
Hi ,
I have a requirement :
Send email Notification when approval is approved or rejected
I have created a email notification :
using placeholder in subject and body ,
after that i have created a email script :
code :
ss:
Now the email is getting triggerd but like this only :
without the content
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:37 AM
@avinashdubey103 Can you try by changing your script as follows.
(function runMailScript(current, template, email, email_action, event) {
// Determine whether the approval was approved or rejected
var isApproved = current.state == 'approved';
// Define subject and body variables
var subject, body;
if (isApproved) {
subject = 'Your MS Teams federation - ' + current.number + ' has been approved';
body = 'Your request for permissions to communicate with partners outside Amdocs via Microsoft Teams ("MS Teams federation") has been approved and is being handled. An email will be sent when you can start using the service.';
} else {
subject = 'Your MS Teams federation - ' + current.number + ' has been declined';
body = 'Your request for permissions to communicate with partners outside Amdocs via Microsoft Teams ("MS Teams federation") has been declined.\nReason: ' + current.comments; // Use the comments field for the reason.
}
// Set the subject and body in the email notification
email.setSubject(subject);
email.setBody(body);
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:58 AM - edited ā10-18-2023 11:02 AM
Hi @avinashdubey103 ,
Make sure you have updated with correct mail script in notification without any spaces in email script name.
Update email script with below 2 lines
email.setSubject(subject); email.setBody(body);
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:36 AM
You have to call the mail script from the body of the email to get it to run.
Change the body of your email to ${mail_script:script_name}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:36 AM
Hi @avinashdubey103 ,
(function runMailScript(current, template, email, email_action, event) {
var isApproved = current.state == 'approved';
var subject, body;
if (isApproved) {
subject = 'Your MS Teams federation - ' + current.number + ' has been approved';
body = 'Your request for permissions to communicate with partners outside Amdocs via Microsoft Teams ("MS Teams federation") has been approved and is being handled. An email will be sent when you can start using the service.';
} else {
subject = 'Your MS Teams federation - ' + current.number + ' has been declined';
body = 'Your request for permissions to communicate with partners outside Amdocs via Microsoft Teams ("MS Teams federation") has been declined.\nReason: ' + current.comments;
}
template.print(subject);
template.print(body);
})(current, template, email, email_action, event);
In notification body use this script : {mail_script:email_test1}
Please mark it as solution proposed and helpful if it works for you.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2023 10:37 AM
@avinashdubey103 Can you try by changing your script as follows.
(function runMailScript(current, template, email, email_action, event) {
// Determine whether the approval was approved or rejected
var isApproved = current.state == 'approved';
// Define subject and body variables
var subject, body;
if (isApproved) {
subject = 'Your MS Teams federation - ' + current.number + ' has been approved';
body = 'Your request for permissions to communicate with partners outside Amdocs via Microsoft Teams ("MS Teams federation") has been approved and is being handled. An email will be sent when you can start using the service.';
} else {
subject = 'Your MS Teams federation - ' + current.number + ' has been declined';
body = 'Your request for permissions to communicate with partners outside Amdocs via Microsoft Teams ("MS Teams federation") has been declined.\nReason: ' + current.comments; // Use the comments field for the reason.
}
// Set the subject and body in the email notification
email.setSubject(subject);
email.setBody(body);
})(current, template, email, email_action, event);