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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Subscription Emails: How to Customize Subject Line Sent Out Via Email?

Jonathan_Cruz
3-Visitor

Subscription Emails: How to Customize Subject Line Sent Out Via Email?

Version: Windchill 12.0

 

Use Case: I have a case where I need to be able to control the Subject Line that is displayed in the email notifications triggered by a Subscription. Running a WC 12.0.2.X system.


Description:

When creating a Subscription, on page 3 (Define Subject and Expiration), the user can input any text they want as the Subject of the Subscription.

Therefore, when an email is sent, the Subject Line of the email is the characters inputted in the Subject.

I need to be able to still allow users to input whatever subject line they want in the Subject field so that it is still visible in Windchill.

But, I want to change the Subject Line that is displayed in the Emails.

 

For workflows, this was fairly simple.

I added the following script to the General.html file between the <html> and <head> tags:

<SCRIPT language=Windchill> <!-- beginSubject --> </SCRIPT>
<SCRIPT language=Windchill> <!-- getInitSubject --> </SCRIPT>
<SCRIPT language=Windchill> <!-- getProcessName --> </SCRIPT>
<SCRIPT language=Windchill> <!-- addText text=" - " --> </SCRIPT>
<SCRIPT language=Windchill> <!-- getActivityName --> </SCRIPT>
<SCRIPT language=Windchill> <!-- endSubject --> </SCRIPT>

 

For Subscriptions, the Subject Line in Emails seems to be coming from a Java class, and therefore adding that script to the subscriptionNotification.html file does not work. (It causes a blank email to be sent with no change to the Subject Line)

 

Does anyone have any advice or experience with customizing the Subject Line displayed in Subscription Emails?

 

As seen in the attached image, I want to change the subject line in the red box.

1 ACCEPTED SOLUTION

Accepted Solutions

Was able to figure this out.

 

To control the Subject Line of the Subscription Notifications, perform the following:

Find the following folder location:
Windchill\codebase\netmarkets\jsp\subscription

This folder contains the JSP files that affect the emails that come out for Subscription Notifications.

defineSubjectAndExpirationStep3.jsp affects the 3rd Page of the Subscriptions Creation.

We want to make the Subject a static value:

Add the following to line 26: enabled="false" hidden="true"

In Line 26, modify the value to be a static line such as "Subscription Notification".

Jonathan_Cruz_3-1715780872600.png

Jonathan_Cruz_4-1715780887536.png

 

After a Windchill restart, here is what the GUI looks like to create a Subscription:

Notice that we cannot change Subscription Subject.

Jonathan_Cruz_2-1715780798493.png

 

View solution in original post

11 REPLIES 11

@Jonathan_Cruz ,

 

You can certainly automatically change the Subject by adding to what the user has entered.

 

As for, "Does anyone have any advice or experience with customizing the Subject Line displayed in Subscription Emails?"

The answer is, yes.

 

But can you be more specific?  Can you spec EXACTLY how you would like this to work.

For example, automatically append the object's number, name to the subject upon creation of the subscription.

Or better yet, user enters subject <any text user wants to enter>.

I need the subject to be:

<any text the user wants to enter> - Number: <object's number>, Name: <object's name>

If the object is renumbered or renamed, the subject to be automatically updated to reflect the new number and new name.

 

Something like that.

 

 

 

 

 

 

 

 

Hello, thanks for replying to me.

I can be more specific.

 

On the Subscription, the user enters for the subject <any text user wants to enter>.

Currently, my email will output the Subject Line as <any text user wants to enter> from the Subscription Subject field.

I want to override that Email Subject Line with something static like "Subscription Notification".

 

My use case is that I am dealing with an ITAR company, and they cannot have any information about their products make it into their inboxes from Windchill.


So I am not looking to append or apply a suffix or prefix to the Subject Line for Subscriptions.

I still want to allow users to enter any text they want in the Subject Line, but have the emails override that Subject Line with a static Subject of "Subscription Notification".

Got it.

 

This is is doable but whatever the user enters in the subject field when they create the subscription will be replace with “Subscription Notification”.

The users might as well enter nothing as whatever they enter will be overwritten.

It's good to know this is doable.

Is there a specific file in the Windchill codebase I would need to edit?

Is it something more complicated than that?

@Jonathan_Cruz ,

 

I have this working for both creating a new subscription and editing an existing subscription.

 

A user creates a subscription and enter either nothing or something other than "Subscription Notification" into the subject field.

d_graham_0-1715078112097.png

They select Finish and the subject field is automatically set to "Subscription Notification".

d_graham_2-1715078306325.png

 

 

That's great, that's a solution that would work for me.

Could you please share how it is accomplished?

Until someone provides a better answer, I have made a temporary solution for myself.

As I explained above, I need to stop free text fields that could possibly contain ITAR information from making it into the employee inbox from Windchill.

I could not figure out how to modify the subject line for "Email Page", but you can just disable that functionality all together.

My specific company does not care too much about "Email Page", so it's acceptable.

 

Folder Location: Windchill\codebase\config\actions

In there, you can find the following file: navigation-actionModels.xml

Find this part here:

Jonathan_Cruz_0-1715089640349.png

 

Take that snippet and put into the custom-actionModels.xml file as so:

Comment out the section for emailPage.

Jonathan_Cruz_1-1715089693343.png

*Remember to use wtSafeArea so that your customization is well-documented*.

After that, the Quick Links will no longer show "Email Page" as an action.

It's effectively disabled.

Jonathan_Cruz_2-1715089757109.png

 

 

Was able to figure this out.

 

To control the Subject Line of the Subscription Notifications, perform the following:

Find the following folder location:
Windchill\codebase\netmarkets\jsp\subscription

This folder contains the JSP files that affect the emails that come out for Subscription Notifications.

defineSubjectAndExpirationStep3.jsp affects the 3rd Page of the Subscriptions Creation.

We want to make the Subject a static value:

Add the following to line 26: enabled="false" hidden="true"

In Line 26, modify the value to be a static line such as "Subscription Notification".

Jonathan_Cruz_3-1715780872600.png

Jonathan_Cruz_4-1715780887536.png

 

After a Windchill restart, here is what the GUI looks like to create a Subscription:

Notice that we cannot change Subscription Subject.

Jonathan_Cruz_2-1715780798493.png

 

Hi @Jonathan_Cruz 

Keep in mind that you need to care about this change next update/upgrade. 

PetrH

That's very much true.

For my specific case, my company won't be updating or upgrading for at least 2+ years.

d_graham
17-Peridot
(To:d_graham)

I’ve added to this a feature to not only force the Subject to say whatever is desired but also the updating of the Subject for existing subscription.

 

The update can be filtered based on the object that is being subscribed and which actions will trigger the notification.

 

I must admit I had not looked into subscriptions much but after a quick look it’s really quite simple to write and implement the code required to do what I’ve described.

Top Tags