• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk PLM 360

    Reply
    Contributor
    Posts: 23
    Registered: ‎03-26-2012
    Accepted Solution

    Help with email script

    141 Views, 6 Replies
    01-30-2013 09:30 AM

    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

    Please use plain text.
    Product Support
    Posts: 157
    Registered: ‎03-27-2012

    Re: Help with email script

    01-30-2013 10:52 AM in reply to: sdibben

    Scott,

     

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



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

    Please use plain text.
    Contributor
    Posts: 23
    Registered: ‎03-26-2012

    Re: Help with email script

    01-30-2013 12:21 PM in reply to: sdibben

    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.

     

     

     

    Please use plain text.
    Product Support
    Posts: 157
    Registered: ‎03-27-2012

    Re: Help with email script

    01-31-2013 05:52 AM in reply to: sdibben

    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.



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

    Please use plain text.
    Contributor
    Posts: 23
    Registered: ‎03-26-2012

    Re: Help with email script

    02-18-2013 07:41 PM in reply to: sdibben

    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.

    Please use plain text.
    Product Support
    Posts: 157
    Registered: ‎03-27-2012

    Re: Help with email script

    02-19-2013 08:20 AM in reply to: sdibben

    Scott,

     

    What are your results if you do a

    Println(item.FEILD1);

    and

    Println(ownerEmail);



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

    Please use plain text.
    Contributor
    Posts: 23
    Registered: ‎03-26-2012

    Re: Help with email script

    02-19-2013 06:04 PM in reply to: sdibben

    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

    Please use plain text.