Help with email script

Help with email script

Anonymous
Not applicable
1,470 Views
6 Replies
Message 1 of 7

Help with email script

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
1,471 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

Scott,

 

Have you tried building out your email address list to a variable first then using that in the email.to field?

Message 3 of 7

Anonymous
Not applicable

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.

 

 

 

0 Likes
Message 4 of 7

Anonymous
Not applicable
Accepted solution

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.

0 Likes
Message 5 of 7

Anonymous
Not applicable

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.

0 Likes
Message 6 of 7

Anonymous
Not applicable

Scott,

 

What are your results if you do a

Println(item.FEILD1);

and

Println(ownerEmail);

0 Likes
Message 7 of 7

Anonymous
Not applicable

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

0 Likes