View all Blog posts

Feature Friday: Taming Your Scripts in PLM 360

By     MARCH 28, 2014

7311992568_810efbe886_oUsing library scripts helps promote code re-use and make your scripts more manageable.  This lets you isolate functions that can be used in multiple scripts.

Today I want to share a really useful Library script that we use quite a bit in our PLM 360 tenant for email notifications.  The example I wrote this morning is quite simple, but you can check out the materials from AU 2013 class PL2758-P for some rich HTML email solutions.

Sending email is quite a common task used by many workflow scripts, so it makes sense to move it to a library script.  It’s pretty straightforward – contains functions for single email or to a list:


And if want to copy and paste and put this in your tenant:

functionality: sends email to multiple users
input   : sendTo{array}(string) – list of email addresses
: subject(string) – subject for the email
return  : body(string)  – body for the email message
example :
var sendTo = [];
var subject(“this is a test”);
var body (“this is the body of the email”);
sendMultiEmails(sendTo, subject,body);

function sendMultiEmails(sendTo, subject, body){

for(var listItem in sendTo)
var email = new Email();  = sendTo[listItem];
email.subject = subject;
email.body = body;

function sendMail(sendTo, subject, body){
var email = new Email();  = sendTo;
email.subject =  subject;
email.body = body;

Here’s the example of a quick action script that will call it (I usually include a lot more fields of information, but this gets the point across!).  Notice I imported the library script for use.


And the resulting email I got:


You can call this action script on the first transition in the workflow and it will pull the email put in the record and send a notification to that address.

Join us next week for PLM Talk Scripting Secrets where we’ll talk more about scripting!


Photo: Beth Scupham