Alfresco: Modifying email link - email

I have deployed a custom workflow, and have email notifications correctly setup for each task. The email links currently look like the following:
https://myCompany.com/share/page/task-details?taskId=activiti$58788
This link takes the user to the details view of the task, and requires them to hit the "Edit" button at the bottom to actually perform the task. Ideally, I would like to change the link to the following:
https://myCompany.com/share/page/task-edit?taskId=activiti$58788
As task-edit allows them to immediately edit the form and perform the task. How might I go about making this change (for just this workflow)?

To change the email template(s) for all notifications: wf-email.html.ftl located in Data dictionary/Email templates/Workflow notification
Change the following html snippet:
${shareUrl}/page/task-details?taskId=${args.workflowId}
Into
${shareUrl}/page/task-edit?taskId=${args.workflowId}
If you're using your own notification mechanism, then create a new email template based on this one and use the path in your Mail task or JavaScript mail action.
---UPDATE---
You can use this JavaScript in you're workflow to send an email, still it's easier to use the AlfrescoMailtask.
// create mail action
var mail = actions.create("mail");
mail.parameters.to = "test#alfresco.com";
mail.parameters.subject = "You've got mail";
mail.parameters.from = "server#alfresco.com";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow notification/My_custom_Template.ftl");
mail.parameters.text = "some text, in case template is not found";
// execute action against a document
mail.execute(document);

Related

Thunderbird78+: How to check for message create, reply and forward

I am a beginner in thunderbird addons so I really appreciate if you can help me. I am trying to find a way in my background javascript to check whenever a user has opened the window for create a new message, reply a message and forward a message. I want to put a default text in the message window before the user is gonna send it. I know thunderbird 78+ should only uses web extension APIs and i found this Compose API but how to use it in my background script.
https://thunderbird-webextensions.readthedocs.io/en/78/compose.html
It looks like setComposeDetails() is what you want.
setComposeDetails(tabId, details)
Updates the compose window. Specify only fields that you want to change. Currently only the to/cc/bcc/replyTo/followupTo/newsgroups fields and the subject are implemented.
tabId (integer)
details (ComposeDetails)
I have note tried it, but I suppose that either details.body or details.plainTextBody from the ComposeDetails object can be used to pass the default text you want to use. So I would try something like this in the background script:
let details = {
body: "This is my default text",
};
browser.messages.setComposeDetails(tabId, details);
You might have to combine it with a call to messages.getComposeDetails() if empty fields in details reset the values in the composer window (I don't know).
If you want to call this when the user opens a new compose window, I would look at the window.onCreated event. If you want to do it right before the message is sent instead, you should look at the compose.onBeforeSend event. All of them are described in the API documentation.

google sheets email script not runnable by all shared people

I have a google sheet shared with other people (I'm the owner) and in it there is a button linked to a corresponding bundle script that send me an email when the user logged press that button (so if I click the button I send an email to me).
All the other people have the "edit" privileges but when they click the button an error occurs saying that it's impossible to send the mail (when I click all works perfectly).
The accounts associated to the other people has the same email domain of mine (not gmail, but related to the same company).
It seems like that the script has different privileges because I have no problem, while the other people do.
As normal, at the first time they click to the button they (but also me) had to accept the google authorization to "send email as you" (as the avatar of the current account logged).
This is the code of the button:
'''
var sheet = SpreadsheetApp.getActiveSheet();
var sel = sheet.getSelection();
var sel_range = sel.getActiveRange();
var message = sel_range.getValues();
// get task IDs
var prev_values = sel.getNextDataRange(SpreadsheetApp.Direction.PREVIOUS).getValues();
var cod_tickets = [];
for (var k in prev_values){
cod_tickets.push(prev_values[k][0]);
}
var emailAddress = SpreadsheetApp.getActive().getSheetByName('Manager').getRange('I2').getValue();
var subject = 'ticket ' + cod_tickets;
MailApp.sendEmail(emailAddress, subject, message);
'''
I say that they send an email to me, because the "emailAddress" variables will be filled with the value of the cell that contains my email address.
Any ideas?
Have a look at the documentation for restrictions for simple triggers:
They cannot access services that require authorization. For example, a
simple trigger cannot send an email because the Gmail service
requires authorization, but a simple trigger can translate a phrase
with the Language service, which is anonymous.
Solution:
Use an installable trigger instead.
Go to Edit->Current Project's trigger
Click on +Add trigger
Select event type On edit.
Your function should no be named onEdit, because otherwise both the simple and installable trigger would fire at once which can lead to problems.
The problem:
The installable trigger will fire for every user, but it will fire on your behalf, so the email will always be you.
If this is a problem, you will need to use a service account that will impersonate the session user, which will make things more complicated.

Why cant I send emails through Google Sheets using a Mobile device?

I opened up a spreadsheet and inserted a Drawing to use it as an Action Button, then I assigned the following script to it:
function sendEmail() {
var emailAddress = 'myemail#gmail.com';
var message = 'test-message';
var subject = 'test-subject';
MailApp.sendEmail({
to: emailAddress,
subject: subject,
htmlBody: message
});
}
Everytime I click the button from a PC, it works fine, I receive the test email instantly. But when I try to test it using any sort of mobile device it won't let me click the button.
Why hasn't google fixed this?
How can I effectively make my script send an email from google sheets using a mobile device? I've already tried with onEdit() and data validation instead of buttons but this doesn't work with the MailApp.sendEmail function, so it doesn't resolve my problem.
Please help
This is a known issue(Star it to show support). Apps Script works from official mobile apps, but buttons with scripts assigned to them do not.
onEdit simple trigger does not work because you need email sending permissions. For this case, an onEdit Installable Trigger can be used.

Is it possible, in NetSuite, to workflow a button to create a new email with no set recipient

currently we have a custom record with a list/record field that links to an opportunity and i can create a button that creates new emails (via workflow) pulling recipient information from the contact on the opportunity record but what i want to know is if there is a way to replicate the "New Email" button usually found on a record's Mail Merge tab as i want to be able to press a button to open an email template that has no recipient set as currently the send email workflow option has both recipient and sender as mandatory fields - is this possible?
You can edit the Custom Record Type to check the 'Enable Mail Merge' checkbox, then you should have this functionality.
If you want the functionality to be available via a button in the main button group, I don't believe this is possible using a workflow only; however you can achieve this with scripting. To do this, create a User Event script with a Before Load function to add the button to the form, and a Client Script which can be called on clicking the button. Upload and deploy to the Custom Record Type that you want the email button to appear on. For this answer I'll assume you have at least a basic knowledge of creating a script record - let me know if you need more information.
The User Event script:
function emailButton(type, form)
{
//add a custom button on the form
//specify the function name of the Client script created in Step 2
form.addButton('custpage_Add', 'Start Email','startEmail();');
//set the internal id of the Client script created in Step 2
form.setScript('customscript_ppcs_start_email_client');
}
The Client script:
function startEmail() {
new_message([['transaction',document.forms['main_form'].elements['id'].value],['entity',document.forms['main_form'].elements['companyid'].value],['template',['66']]], 'EMAIL');
}
You can modify the template used by replacing the '66' with the internal ID of the template you want, or you can remove it. You can also remove the 'entity' as you don't want the recipient to be set. Below is an example with both removed:
function startEmail() {
new_message([['transaction',document.forms['main_form'].elements['id'].value]], 'EMAIL');
}

load magento email template

I'm using my own code to send out SMS's to the customers at the same time as the emails go out. I do this by getting the email template code with
$code = $this->getTemplateCode();
and then trying to load the corresponding SMS template with
$sms = $this->loadByCode('sms_'.$code)->getTemplateText();
I then check if $sms is empty before proceeding to send the text, meaning that I can add or remove connected SMS templates at will. The problem I'm having is that I sometimes, when there is no connected "sms_*" template, I get the full email sent out as the SMS instead of no text being sent.
I've debugged the code by sending out the template it tries to load as the actual SMS, and received "sms_creditmemo", but when I instead load it with the method above and do a var_dump($sms); exit;it shows me that it loaded the template "creditmemo_invoice" which is the email template I use instead of "creditmemo" when the payment method is detected. I make sure to use the original template string in $code (used to load SMS template) no matter the payment method.
Now my question would be how this can even be possible, does the loadByCode take best matching template or is there some other more serious bug I've missed, maybe there's better ways to load in the templates and make correct checks to see if they even exist?
I solved this by checking if the correct email template gets loaded with
if ($this->loadByCode($template)->getTemplateCode() == $template)