Skip to main content
Solved

Email Template from Opportunitie

  • Feb 27, 2024 3:44 AM UTC
  • 2 replies
  • 87 views
  • Translate All

Forum|alt.badge.img+1

I would like to add an action to the Opportunity screen that would load an email template, populate the template with fields from the Opportunity.

The part I struggle with is how to load template X and have the fields populated in an email activity.

 

 

Best answer by Zoltan Febert

You can get an email template like this:

var templateID = "your template ID";

var notification = PXSelect<Notification,
Where<Notification.notificationID, Equal<Required<Notification.notificationID>>>>
.Select(Base, templateID);

Once you have it, you can modify the body:

notification.Body = notification.Body.Replace("{YourField}", yourValue);

 

View original

2 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+4
  • Jr Varsity I
  • Answer
  • Feb 27, 2024 3:49 PM UTC

You can get an email template like this:

var templateID = "your template ID";

var notification = PXSelect<Notification,
Where<Notification.notificationID, Equal<Required<Notification.notificationID>>>>
.Select(Base, templateID);

Once you have it, you can modify the body:

notification.Body = notification.Body.Replace("{YourField}", yourValue);

 

Translate

Forum|alt.badge.img+1
  • Author
  • Varsity I
  • Feb 29, 2024 8:33 PM UTC

Okay, I started with the above comment. it works, I was just thinking there was a more elegant way. Thanks!

Translate