Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8465297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:00:12+00:00 2026-06-10T15:00:12+00:00

I am new to Alfresco (version 4) and I would like to create webscript

  • 0

I am new to Alfresco (version 4) and I would like to create webscript (lib.js actually) for sending email that has function with following signature:

function sendMail(to, subject, templatePath, templateArgs )

This function would be called from other webscripts when some conditions are met. I have found script like this:

var mail = actions.create("mail");
mail.parameters.to = "receiver_email@some.domain";
mail.parameters.subject = "Test subject";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow Notification/wf-email.html.ftl");

var templateArgs = new Array();
templateArgs['workflowTitle'] = "workflowTitle";
templateArgs['workflowPooled'] = true;
templateArgs['workflowDescription'] = "workflowDesc";
templateArgs['workflowId'] = "workflowId";

var templateModel = new Array();
templateModel['args'] = templateArgs;
mail.parameters.template_model = templateModel;

mail.execute(search.findNode("workspace://SpacesStore/9e15aaac-b30b-4266-984f-21fe273a6113"));

but I don’t know how to put it in my code, since I don’t know three things:

  • Can I use this code in my scenario, i.e. to make js lib which can be imported and used to send various emails?

  • If I can, where can I find reference to actions (what to import at the begining of the file)?

  • What should I put as an argument to mail.execute function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:00:15+00:00Added an answer on June 10, 2026 at 3:00 pm

    mail.execute is the “against” rule. It means that the code asks you to execute the function against a node in alfresco. So, when you send an Email when you upload a document, the mail.execute uses the freshly created node, so you could append in the mail the link to the newly created file.

    you could simplify that, anyway, and create a rule, that triggers on some content when it’s created/updated, and use the sendmailaction.js as the one that you posted above, automatically to users you want.

    otherwise you can create something like this:

    function sendMail()
    {
        var mail = actions.create("mail");
        mail.parameters.to = bpm_groupAssignees.properties["cm:email"];
        mail.parameters.subject = "New File uplodaded with name " + document.name;
        mail.parameters.from = initiator.properties["cm:email"];
        mail.parameters.text = "Kindly approve the document: " + document.name;
        mail.execute(document);
    }
    sendMail();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have 2 models. I have a medicalBillModel that I would like to
I'm trying to create a form filter, that would do some post-processing of a
New to linux and c++. I wante to create an application that only needs
Hi I am new to Alfresco I have installed enterprise edition of Alfresco but
New to spring. I'm getting the following exception being caught: 2012-06-14 16:20:57,719 [http-8080-6] ERROR
[ Solved , it seems that there was some bug affecting Alfresco 3.3.0, which
New to jquery question... Using jQuery, depending on the radio button clicked I would
I'm new to alfresco, and despite some research, I did not find how to
I'm trying to extend Share DocumentLibrary with a new action that provide a link
New to MonoTouch and MonoTouch.Dialog, but I'm sure it's possible to create a tab

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.