Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I need to send a notification when an item is created against a specific project. the recipient of the email should be the Project Manager of that project and I am using a FVA field to copy the project manager into the newly created item.
I then created a trigger to fire on newly created items and added the advancedemail.js assigning the FVA field to the recipient.
I have tried both a Pre and Post trigger but what seems to happen is the FVA field is not populated until after the trigger has fired therefore sending no email.
Surely the Post event trigger should send the email to the user in the FVA field as suggested.
What am I doing wrong or does anyone have an alternative.
Solved! Go to Solution.
We use the same trigger.
The code looks somehow like this:
....
var reciever = delta.getNewFieldValue("projectmanager_fva");
logDebug(" < projectmanager_fva mail address > = "+ reciever);
if (reciever == null){
config("\n\n The Script dare only run for projectmanager_fva != null! \n\n Tell you Admin to check the Trigger Rule Settings! ");
return;
}
var mailAddress= sb.getUserBean(reciever).getEmailAddress();
if (mailAddress!= null){
logDebug(" send mail to < projectmanager_fva mail address > = "+ mailAddress);
mySendMail(sender, mailAddress, subject.toString(), msg.toString());
}else{
logDebug(" no mail address for user = "+reciever);
}
....
HTH Matthias
This really should work with a Post trigger. Perhaps working through the process with a support engineer would help sort this out. I would recommend opening a support case and possibly doing a screen sharing session.
We use the same trigger.
The code looks somehow like this:
....
var reciever = delta.getNewFieldValue("projectmanager_fva");
logDebug(" < projectmanager_fva mail address > = "+ reciever);
if (reciever == null){
config("\n\n The Script dare only run for projectmanager_fva != null! \n\n Tell you Admin to check the Trigger Rule Settings! ");
return;
}
var mailAddress= sb.getUserBean(reciever).getEmailAddress();
if (mailAddress!= null){
logDebug(" send mail to < projectmanager_fva mail address > = "+ mailAddress);
mySendMail(sender, mailAddress, subject.toString(), msg.toString());
}else{
logDebug(" no mail address for user = "+reciever);
}
....
HTH Matthias