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

    Autodesk PLM 360

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

    Derived field from Picklist

    237 Views, 7 Replies
    12-23-2012 05:38 PM

    I have created a pick list with the pick list option as USER, ALL by name.  This allows me to assign an individual as a resource.  After creating this I need to have the selected USER's email address for a script to send him an email.  It is not allowing me to make a derived field from that picklist.  

    If this isn't possible what are my options for assigning different people as a resource and emailing only that individual at certain transitions.  Thanks.

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

    Re: Derived field from Picklist

    12-27-2012 09:28 AM in reply to: sdibben

    Hello and Welcome.

    Correct what you are trying to achieve cannot be done by derived fields, however a on creation or on edit script can pull the information from the user (by using the userid), and populate a given field with in the workspace with that users given email.

     

    This will then allow you to call upon the email field and use that as the address to send the email in question.



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

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

    Re: Derived field from Picklist

    12-27-2012 11:59 AM in reply to: sdibben

    Thanks Joe,  That gets me part of the way.  From the USER, ALL by Name pick list it will grab lastname and first name (Doe, John).  I see no way of getting the email address from the last and first name.  The Security.loaduser (userID) requires the login for Doe, John.  How will I get the UserID for the All by Name pick list item?  I see nothing in the script reference that shows this can be done.  Thanks again

    Please use plain text.
    Distinguished Contributor
    Posts: 153
    Registered: ‎10-04-2012

    Re: Derived field from Picklist

    12-30-2012 12:40 AM in reply to: sdibben

    Hi,

     

    I had the same problem. See the following post;

     

    http://forums.autodesk.com/t5/Autodesk-PLM-360/User-email-address-in-scripting/td-p/.UN_7wXwgGSM

     

    I had to use a work-around. All of our system user names have the following format;

     

    Example username: dkeeley

    Example name: Keeley: David

    Example email: dkeeley@company.com

     

    As you have pointed out the only value that can be extracted from the pick list is the 'name' value. There's currently no way to get the associated email address by scripting. So instead I used some string scripting to convert the 'name' to the 'username' and then add a '@company.com' to the end of it. It seems to work well but has some limitations. For example the 'admin' user will not receive emails using this method (but some conditions can be built into the script to overcome this if necessary)

     

    Hope this helps,

     

    David. 

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

    Re: Derived field from Picklist

    01-02-2013 07:18 AM in reply to: sdibben

    David,

     

    Thank is an excellent option, one I haven’t thought of.

     

    As to the original concept, a script could create a userid from the first name and last name, if you uses a standardized userid, with would then give you access to everything. 



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

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

    Re: Derived field from Picklist

    01-02-2013 07:29 AM in reply to: sdibben

    Thanks for the help.  That is the direction I will go.

     

    Scott

    Please use plain text.
    Distinguished Contributor
    Posts: 153
    Registered: ‎10-04-2012

    Re: Derived field from Picklist

    01-02-2013 08:16 AM in reply to: sdibben

    Hi Joe,

     

    Yes you are correct. As soon as you have created the use rid from the username then the email address can be extracted automatically. 

     

    Glad this helped. i've given the script for converting the username to user I'd in my original post. 

     

    david. 

    Please use plain text.
    Distinguished Contributor
    Posts: 153
    Registered: ‎10-04-2012

    Re: Derived field from Picklist

    01-02-2013 08:18 AM in reply to: dkeeley

        var user_name_length = user_name.length;

        var char_position = user_name.indexOf(',');

        var letter = user_name.charAt(char_position + 2);

        var user_surname = user_name.substring(0,char_position);

        var user_id_temp = letter + user_surname;

        var user_id = user_id_temp.toLowerCase();

        var user_details = Security.loadUser(user_id);

        email.to = user_details.email;

    Please use plain text.