- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 05:49 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 09:27 PM
Those who replied and helped were really appreciated. Thanks all for that !! @Murthy Ch @Sharanya Hegde3 @Mohit Kaushik
This issue has been fixed now by referring OOB emai script "pwd.enrollment_reminder". We dont need to check array length and no need to pass array data with counter in addquery which was causing this issue (Still not sure of logic behind this). Refer to the updated piece of code for reference.
Happy Learning from mistakes !!!
var app = grKri.ABC.approver.split(",");
var appuser = new GlideRecord("sys_user");
appuser.addQuery("sys_id",app);
//appuser.addQuery("notification", 2); //email
//appuser.addQuery("email", "!=", "");
gs.info("in submit script 4 tostring " + app);
appuser.query();
while (appuser.next()) {
var mail = appuser.email.toString();
var name = appuser.getDisplayValue();
gs.info("in submit user email: " + mail);
gs.info("in submit user name: " + name);
email.addAddress("cc", mail, name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 07:42 AM
Hi @MPP22
If those logs are not coming then there is an issue in above lines.
What is this ABC here?
var app = grKri.ABC.approver.toString().split(",");
I think that is causing the issue.
Is that a proper field name?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 07:47 AM
yes it is as its working in the background script. Surprisingly not one simple info statement (before and after loops) can see in system logs. This script gets called in Notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 07:50 AM
Hi @MPP22
So have you called the email script correctly in notification?
${mail_script: mailscriptname}
Can you share the screenshots if possible?
Can we have a quick Gmeet: manichintalapudi9@gmail.com?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 08:06 AM
@Murthy Ch - Came to the conclusion after some changes. The script after the while loop (while (user.next()) {) is not working and not getting this info in logs. Any heads up why sysid is not getting matched with approver sysid as its exist in user table.
var app = grKri.ABC.approver.toString().split(",");
var cnt = app.length;
for (var i = 0; i < cnt; i++) {
var user = new GlideRecord('sys_user');
user.addQuery("sys_id", "=", app[i]);
gs.info("in submit script 4 "+app[i]);
user.query();
while (user.next()) {
var email = user.email.toString();
var name = user.name.toString();
gs.info("user email: "+email);
gs.info("user name: "+name);
email.addAddress("cc", email, name);
//email.addAddress("cc", user.email, user.getDisplayValue());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2022 08:25 AM
Hi @MPP22
Not really sure.
Have you checked what is coming in this info?
Is it giving active user sys_id?
gs.info("in submit script 4 "+app[i]);
Murthy