I have a question regarding an email script. I need to email a print view of a workspace to two individuals. I have no problem with the script for one person but if I try combine two email addresses it will not work
FIELD1 holds an email address
var email = new Email();
var emailbody= getPrintView('EMAIL');
var owner = Security.loadUser (userID);
var ownerEmail = owner.email;
email.to = item.FIELD1 +';' + ownerEmail;
email.subject = ' Estimate';
email.body = emailbody;
email.send();
This looks correct when sending this as a combined variable to a text field. The script shows no errors but does not seem to work. Thanks for any help
Solved! Go to Solution.
Solved by jpiggee. Go to Solution.
Scott,
Have you tried building out your email address list to a variable first then using that in the email.to field?
This is what I tried for building it into a variable. This was also unsuccessful. Let me know if you see anything wrong.
FIELD1 holds an email adress
var email = new Email();
var emailbody= getPrintView('EMAIL');
var owner = Security.loadUser (userID);
var ownerEmail = owner.email;
var totalEmail = item.FIELD1 + ';' + ownerEmail;
email.to = totalEmail;
email.subject = 'Estimate';
email.body = emailbody;
email.send();
If I use email.to = ownerEmail or email.to = item.FIELD1 it works fine. I have not been able to put these together.
Scott,
Sorry I was thinking a version past what we’re working with…
In the 8.0 release (next month) you will be able to use comma delimited listing for multiple email address entries.
I'm having problems with the email script not completing again. It is initiated by a transition. It shows no errors on the script after running.
FIELD1 contains an email address.
SE_EMAIL is an advanced print view created in the workspace
var email = new Email();
var emailbody= getPrintView('SE_EMAIL');
var owner = Security.loadUser (userID);
var ownerEmail = owner.email;
email.to = item.FIELD1;
email.cc = ownerEmail;
email.subject = 'Estimate provided';
email.body = emailbody;
email.send();
This has worked in the previous weeks without the email.cc field. I commented out the email.cc and ran the script again. It still did not complete.
Scott,
What are your results if you do a
Println(item.FEILD1);
and
Println(ownerEmail);
Joe,
The printIn helped to identify the problem, thanks. I moved the field holding the email address to the "unassigned field" column in the workspace. This field is derived from another workspace and has no real value to the workspace except to hold a value for the email script. I have a few of these unassigned fields in the workspace. So apparently the unassigned fields are not available for scripting to access? As soon as I moved it back to "item details field" column in the workspace the script could access the value again.
I use these "unassigned field" items as values in computed field formulas and they can retrived the values where the scripts can't. Is this intended for some reason? Let me know if you need more information. Thanks
Scott Dibben
D3 Technologies