- 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 09:43 PM - edited ‎10-06-2022 09:44 PM
Try the below code with proper tabl names
var grOp = new GlideRecord('XYZ');
grOp.addQuery('sys_id', current.getUniqueValue());
grOp.query();
if (grOp.next())
{
var grKri = new GlideRecord('DFG');
grKri.addQuery("sys_id", grOp.getValue('transaction'));
grKri.query();
if(grKri.next())
{
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", cnt[i]);
user.query();
if (user.next())
{
email.addAddress("cc", user.getValue('email'), user.getValue('name'));
} }