Search

Data Management: How to Customise Notification Templates in SOLIDWORKS PDM

Wednesday October 18, 2023 at 8:00am

SOLIDWORKS 2023 introduced customising email notifications to SOLIDWORKS PDM.

It has always been possible to make some minor changes to notification templates, but the process was fraught with limitations and some frustration when after each upgrade, your changes were reset back to the defaults.

Now it's nice and straightforward in SOLIDWORKS PDM 2023 and onwards with a little bit of HTML coding.

Let’s show you some of the basics of customising notifications in SOLIDWORKS PDM, such as adding a new variable column and changing the colour of selected fonts.

We’ll also go a step further to show you a great way of adding a company logo or other image to the email template without having to host that image externally (and potentially have it blocked from displaying in your email client by default).

TABLE OF CONTENTS

  1. How to Customise Notifications in SOLIDWORKS PDM
  2. Default Templates for SOLIDWORKS PDM Notifications
  3. How to Change Colours in SOLIDWORKS PDM Notifications
  4. How to Add Variables to SOLIDWORKS PDM Notifications
  5. How to Add Images to Notifications in SOLIDWORKS PDM

How to Customise Notification Templates

As of SOLIDWORKS PDM 2023, SOLIDWORKS PDM now provides administrators the option to customise the templates used for automatic notifications sent via SMTP and DataBase mail within your PDM vault.

This will allow you to include additional information that may be more useful to the user.

Before we begin however, you will first need to ensure that you have the update mail configuration administrative permission enabled.

Although the most common type of notification we see is Changed State, notifications can be triggered for a number of reasons, and we are able to customise the full range of templates used when files are:

  • Added
  • Changed State
  • Checked In
  • Checked Out
  • Delayed in State

These are shown within the Notification Templates node within the Administration Tool in SOLIDWORKS PDM 2023 onward.

After selecting the template you wish to modify, you will have the option to edit both the subject and body in HTML format, including the insertion of Card Variables within the notification message.

This is done using the flyout menu in the Customise window alongside the subject and body text boxes.

To access the Customise dialog box you can simply double click the notification template that you wish to edit.

Within the form there are a number of sections:

  • Name is a read-only field that displays the name of the notification template.
  • Preview displays how the template appears to users.
  • Template allows selection of either notification template option to Default or Custom.

If you select Custom, the fields listed below are enabled to enable you to customize the notification template.

  • Subject displays and allows for the notification subject to be edited. To include variables, click the chevron icon and select a required variable.
  • Body displays and allows for the notification body to be edited. To include variables, click the chevron icon and select a variable.
  • Load from File imports HTML text into the body of the notification.
  • Reset will restore the notification template to the default template.

For offline editing in a standalone editor, you can export notification templates.

Whilst it is possible to export all via a single right click over the notification templates node, as we want to look specifically at the Changed State template, we will want to drill down to that specific template, right-click and select Export.

We’ll create a customised state change notification that looks like this:

THE DEFAULT TEMPLATE

Let’s look at the default state change notification in the preview.

We can see that that there are number of sections.

The header includes a coloured cell with white text followed by two lines that describe the reason for the notification.

The main body contains a repeat block table where additional rows will be added for each file.

We must be cautious when modifying this table not to delete the hyperlinks as there is some underlying code linked to each of those hyperlinks that it would be unwise to change.

NOTE: clicking in the filename column ‘opens’ the file in its default editor and clicking in the ‘View’ column opens it in its default viewer.

For many files, this would be the same application, so you may choose to remove ‘View’ completely – the difference being the checkout prompt.

The footer section currently displays the notification and state change comments added by the user at the point the transition was triggered.

If you are new to HTML, then modifying the code can be a bit daunting, but it reads top to bottom, and we’re able to find and change the sections we want with a bit of trial and error.

HOW TO CHANGE COLOURS IN SOLIDWORKS PDM NOTIFICATIONS

Let’s begin by changing the >colour block in the header to the blue of Solid Solutions.

In HTML, colours are described as a hexadecimal code or by RGB values. This is something you can easily get with a colour picker or through MS Word or an image editor.

In the Solid Solutions branding, the blue has a hex value of #1D4F91 and the grey #BFBFC3.

Looking at the code, we see a section near the top that contains the text, “SOLIDWORKS PDM Notification”.

This suggests that this is that pale blue block. In there we see a Background-color tag and after changing that to #1D4F91 and opening the preview we see we made the change correctly.

<div style="background-color: #1D4F91; font-size: 20px;color: white; padding: 13px; text-align: center">
<font face="Arial">SOLIDWORKS PDM notification</font>
</div>

HOW TO ADD VARIABLES TO SOLIDWORKS PDM NOTIFICATIONS

Next, we want to add a Description column to the table.

We can change the variables displayed and the font styles used in a table.

We’ll modify the code layout to make it easier to follow by adding some carriage returns between the <td> and </td> tags that define each Table Data cell.

We can then add an extra cell by copying and pasting a line from a <td> element, and renaming it to Description as in the image above. We can also change the colour too by swapping over the hex value.

Check the preview after making changes. We can see this has updated to reflect the new code and shows that we now have an extra header cell called ‘Description’, but we still need to insert the description variable into the body between the File Name and the View text.

We’ll copy a <td> element within the repeat block, then insert the required Variable from the flyout menu.

Decide if you want the URL to ‘Open’, ‘View’ or ‘Browse to’ the target file. In this example we have set it as open.

We’ll repeat the font colour changes on the fixed text in the footer, and we can also copy the HMTL for the line break that was above State Change Comment to also appear above Notification Comment.

Line break code: <hr class="line1">

HOW TO ADD AN IMAGE TO SOLIDWORKS PDM NOTIFICATIONS

Finally, we will add an image to our SOLIDWORKS PDM notification.

The Solid Solutions logo will look great in the header.

There are a couple of options for inserting images. We mentioned earlier that in a typical webpage, when an image is displayed it is loaded in via HTML code that points to a specific location (HREF).

So, one option would be to add our logo to a public location on our website, or even in a file sharing platform such as Google Drive.

After uploading and setting the share options for the image you would need to extract the specific share URL.

If the original URL is:

https://drive.google.com/file/d/0B6wwyazyzml-OGQ3VUo0Z2thdmc/view

You would copy the ID from the original URL (the characters between the /d/ and /view), and use it in this URL:

https://drive.google.com/uc?export=view&id=0B6wwyazyzml-OGQ3VUo0Z2thdmc

The formatting within the notification could then look something like this:

<body>
<imgsrc="https://drive.google.com/uc?export=view&id=0B6wwyazyzml-OGQ3VUo0Z2thdmc">
<br>
<a href="https://drive.google.com/uc?export=download&id=0B6wwyazyzml-OGQ3VUo0Z2thdmc" download>Download</a>
</body>

This method requires a reasonable amount of housekeeping for something that may just be a small logo.

So, instead we suggest embedding the image directly into the code, by converting it to Base64 code.

NOTE: We should be clear though that Base64 is only useful for very small images.

Base64 is an encoding algorithm that converts any characters, binary data, plus images or sound files into a readable string, which can then be saved or transported over a network without data loss.

The characters generated from Base64 encoding consist of Latin letters, digits, plus, and slashes.

When it comes to larger images, the encoded size of a picture in bytes will end up being much larger than JPEGs or PNG files.

This can result in slow page load times and an increased amount of bandwidth usage when the notification is sent.

There are lots of tools online to convert an image to Base64 and we obviously can’t vouch for all of them. In this example we used https://www.base64-image.de/ which created an 11 KB code snippet.

Once you have the code, you can then insert it into the HTML wrapped in an <img> element with any additional formatting you want to include.

Here we’ve set the image alignment to be centred, then revert back to left alignment after the inserted code snippet. We also added an alt tag to provide support for screen reader software.

The preview looks good, but you will note the image is quite large.

Base64 images will be sized in pixels as per the source image, but you can also include Width and Height values within a style tag if preferred.

e.g. <img src="'data:image/png;base64,' + your_base64_string" style="width:50px;height:250px">

Now whenever a file changes state we’ll be greeted with this notification, and the customised layout will carry forward to future versions as you update and upgrade SOLIDWORKS.

Take the Next Steps...

Master data management with our CPD-accredited SOLIDWORKS PDM training courses. Our friendly and expert Trainers have first-hand experience of implementing and using SOLIDWORKS PDM in industry and are ready to help you get started, either online or in a classroom near you.

Why not take a deeper dive into SOLIDWORKS PDM and learn how PDM can work for you and your business?

Or get in touch with us directly to discuss your specific solutions today on 01 297 4440.

As part of the TriMech Group, we can not only implement SOLIDWORKS PDM, but support you and your users throughout your design journey with our expert Technical Support team, helping to give you a smooth experience and keep your projects on track.

Related Blog Posts

How to Create Virtual Sharps in SOLIDWORKS
Boost your SOLIDWORKS sketching speed with this helpful tip!
4 Ways to Add Custom Properties in SOLIDWORKS
Learn how to add custom properties in SOLIDWORKS.
Who Uses SOLIDWORKS in Scotland?
Discover the companies who are designing with SOLIDWORKS across Scotland.

 Solid Solutions | Trimech Group

MENU
Top