cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Is any API or customization available to retrieve PLM user email address?

prescient_rohit
7-Bedrock

Is any API or customization available to retrieve PLM user email address?

I am using Windchill PDMLink Release 11.2 and Datecode with CPS 11.2.0.0

Is any API or customization available to retrieve the PLM user email address to be used to send email notifications?
Email is to be used in customization provided in Article - CS63309.

Or any way to retrieve "DefaultNotificationSenderEmail".
1 ACCEPTED SOLUTION

Accepted Solutions

Do you just need the address? Try this:

((WTUser)localWTPrincipal).getEMail()).getAddress();

View solution in original post

4 REPLIES 4

Do you just need the address? Try this:

((WTUser)localWTPrincipal).getEMail()).getAddress();

Thank you @avillanueva for the quick reply.

As I am using Article - CS63309 to send email notifications, but am not able to receive any emails.

Does it require any configuration before using the customization provided in the article?

This is a snippet I use to create my own workflow task notification email. I know that general email notifications might vary slightly but they all use a template. Does this help? Aside from receiving emails, you can check that the queue is actually creating the notification. If you stop the queue, you can see if it indeed is being queued up to send an email.  If you restart the queue, the task will disappear after its processed and the email should be on its way. Unless there is something outside of the system that is not delivering it. Sry for simple question but have you verified that other emails are being send from system properly and just not these custom ones?

WTDistributionList distroList = new WTDistributionList();
        Persistable p = null;
        if ((workItem.getPrimaryBusinessObject() != null) && (workItem.getPrimaryBusinessObject().toString() != null))
          p = workItem.getPrimaryBusinessObject().getObject();
        if (AccessControlHelper.manager.hasAccess(user.getPrincipal(), p, AccessPermission.READ)) {
          LOGGER.debug("adding " + user.getDisplayName() + " to distribution.");
          distroList.addPrincipal(user.getPrincipal());
        }
        TemplateEmailNotification email = new TemplateEmailNotification(distroList);
        Object[] arrayOfObject = new Object[5];
        arrayOfObject[0] = activity.getName();
        email.setSubjectResource("wt.workflow.work.workResource");
        email.setSubjectMessageKey("124");
        email.setSubjectInserts(arrayOfObject);
        //PDML-10 - Improved email templates showed call out of template processor was incorrect.
        WfTaskNotificationProcessor processor = new WfTaskNotificationProcessor(workItem);
        //processor.setWorkItem(workItem);
        email.setTemplateProcessor(processor);
        email.setTemplate(TemplateName.getWorkNotification("General"));
        //processor.setState(new TemplateProcessorState());
        String str = "";
        try {
            str=WTProperties.getLocalProperties().getProperty("wt.notify.notificationSenderEmail");
        }
        catch (IOException e) {}
        WTPrincipal localWTPrincipal = activity.getParentProcess().getCreator().getPrincipal();
        if (localWTPrincipal instanceof WTUser) {
          try {
            str = new InternetAddress(((WTUser)localWTPrincipal).getEMail()).getAddress();
          }
          catch (NullPointerException nullE) {}
          catch (Exception e)
          {
              LOGGER.debug("Exception while creating IntenetAddress==>");
          }
          LOGGER.debug("Sender:" + str);
        }
        email.setSender(str);
        LOGGER.debug("Created email, returning.");
        return email;

 

Thank you @avillanueva for the suggestion.

Basically, I need to configure the SMTP configuration first.

Top Tags