Hi,
I have a test script that I use to send an email containing an advanced print view to a all the members of a group. When I try and run the script I get a script timeout error message (the group contains two members). I have attached the error message. The script is as follows;
var email = new Email();
email.subject = 'Emergency Problem Report Notification';
//email.body = 'Test';
email.body = getPrintView('Emergency Email');
var users = Security.listUsersInGroup('ST Test');
for (var index in users) {
email.to = users[index].email;
//email.to = '[personal]@hotmail.com';
email.send();
}
When I reduce the number of members in the group to 1 person the script works fine. I have tried making the following changes to begus the script but it continues to fail;
- change the group members
- change the advanced print view
- change the test dmsID
It seems that I cannot get the script to send the advanced print view to more than one person.
When I change the email body from an advanced print view to a text body the script runs fine and sends the email to all group members;
var email = new Email();
email.subject = 'Emergency Problem Report Notification';
email.body = 'Test';
//email.body = getPrintView('Responsible Person Email');
var users = Security.listUsersInGroup('ST Test');
for (var index in users) {
email.to = users[index].email;
//email.to = '[personal]@hotmail.com';
email.send();
}
Please can you assist?
Hi,
I have not been able to reproduce the script error with a group of 4 users using an advanced print view found in my Items and BOMs workspace. Testing the action script showed that it executed successfully.
Is your advanced print view very complex? Could you try to call the advanced print view from one of your item and see if that works outside of the scripting environment? Could there be something unique about the group? I understand you have tried changing various parameters but not sure if you have tried changing the group itself. Also please look into whether issue is reproducible in another browser.
Hi Bastien,
I performed the following further tests. In each instance I continue to get the same script timeout error.
1. I tested the script in IE, Firefox & Chrome
2. I tried using two different users in the group
3. I tried using a completely different group
4. I tried using a very simple test advanced print view (see attached image 'Simple APV)
I also checked to see if I can generate the print views within the item view by pressing 'print' (i.e. outside of scripting). In each case the print view generated correctly and without any problem.
Regards,
David
Hi David,
No updates at this present time. I will follow-up and update you as soon as possible.
Thank you.
Hi David,
Upon further review of your script, we believe we found an issue. Could you please try this new script instead and let me know if that works better for you? Notice the + sign for append in the if / else loop within the for loop.
var email = new Email();
email.subject = 'Emergency Problem Report Notification';
email.body = getPrintView('Emergency Email');
var users = Security.listUsersInGroup('ST Test');
var emailsTo ='';
for (var index in users) {
if(emailsTo === ''){
emailsTo = users[index].email;
}else{
emailsTo += ',' + users[index].email;
}
}
email.to = emailsTo;
email.send();
Hi David,
I will follow-up with you shortly.
Regards,
Can't find what you're looking for? Ask the community or share your knowledge.