Alfresco - add recipient's name to workflow notification email template - alfresco

I'm using Alfresco 5.2 Community. I'm trying to edit the template wf-email.html.ftl file found in Repository> Data Dictionary> Email Templates> Workflow Notification> wf-email.html.ftl.
In the line
<p>Hi,</p>
I want to add the recipient's name in the message, something like
<p>Hi John,</p>
Is this possible? If yes, how is it achieved?

Unfortunately, the assignee is not passed as an argument to the template, so it is not available to the template. You can see this by looking at the source of the class that actually sends the notification:
https://github.com/Alfresco/alfresco-repository/blob/master/src/main/java/org/alfresco/repo/workflow/WorkflowNotificationUtils.java
Looking at that class you can see where things like the workflow ID, title, and description are added as arguments that get passed to the template renderer:
templateArgs.put(ARG_WF_ID, taskId);
templateArgs.put(ARG_WF_TITLE, taskTitle);
templateArgs.put(ARG_WF_DESCRIPTION, description);
But the assignee is not passed.
You could lookup the workflow and then get the current task and then get the assignee to that task, but that's probably not the best way to go about it.
If you really need this, I would extend the existing WorkflowNotificationUtils.java with my own, and add in the assignee as an argument to the template. Or I'd turn off the default notifications and just use my own notification classes that my custom workflows call.

Related

Enter ConversationHandler ignoring entry_points

I'm using python-telegram-bot wrapper to create NLP based chatbot and I want users to have an option how to use the bot:
InlineKeyboardButton menus
natural language conversation
For the first option I am having several ConversationHandlers defined, most of them are having entry_points defined as single CallbackQueryHandler:
location_handler = ConversationHandler(
entry_points=[
CallbackQueryHandler(
callback=nearest,
pattern=NEAREST_CB
)]
And for the second option I am using MessageHandler:
text_message_handler = MessageHandler(Filters.text & (~Filters.command), call_model)
I wanna enter one of those ConversationHandlers whenever my model (call_model function) returns an appropriate tag, but have no idea on how to do it.
text_message_handler = MessageHandler(Filters.text & (~Filters.command), call_model)
I wanna enter one of those ConversationHandlers whenever my model (call_model function) returns an appropriate tag, but have no idea on how to do it.
call_model is your handler callback, though, right? The callback can't determine whether or not the handler is executed.
That is the job of the handler. So you should probably implement either a custom filter to use with MessageHandler or just a custom handler and put your NLP logic in there. Please see this page for details on custom filters and this page for the abstract Handler class that you'd need to implement for a custom handler.
Disclaimer: I'm currently the maintainer of python-telegram-bot

How do I find out a field's type information for a 'record' in appmaker in Server script?

I'm trying to create a re-usable script for capturing record changes onSave with Server-side scripting. To do that, I need the model information for a given table, including what type each field is.
I have figured out how to get the model for my table and details for the fields:
var table = "Clients";
var myObject = app.models[table];
// Dump the properties of the 2nd field in the model
console.log("Field 2 properties: " + JSON.stringify(myObject["L"]["fields"]["1"]));
I see this:
{"name":"Client",
"key":"zzzkS1spSPKkRXMn",
"displayName":null,
"description":"Short name for client (must be unique)",
"type":{},
"required":false,
"uid":false,
"defaultValue":null,
"minLength":0,
"maxLength":null,
"integer":false,
"sortable":true,
"minValue":null,
"maxValue":null,
"regexp":null,
"regexpError":null,
"possibleValues":null,
"aggregationType":null
}
"type" looks like an empty property here and I can't seem to figure out how to get any reference to it to tell me what I need.
How do I get usable type information for a given field in a model?
Right now, App Maker doesn't expose an API to access the model metadata.
You snippet is actually accessing App Maker's internal state and might break in future releases (the "L" property is actually obfuscated by a JS compiler and not designed to be accessed from user land).
We know this kind of meta-programming is handy and this is something we might add in the future based on user feedback. Please feel free to submit a request feature in our issue tracker (https://developers.google.com/appmaker/support).

How do I add a collection of builtin book actions to my app's section?

My app publishes the builtin actions:
og.likes
books.reads
books.wants_to_read
I can create a collection for my app's section that includes the builtin og.likes (Called recently liked) but I can't figure out how to add the other collections to my section. (books.reads, books.wants_to_read)
When I goto https://developers.facebook.com/apps/APP_ID/opengraph/collections and click "Create a New Collection" the Action Type dropdown only includes Like. Read and Want to Read are missing. All these actions have been approved for my app.
What am I missing here?
How do I add these collections to my app's section?
Thanks,
Blair
you've to create the action for your app (read and wants_to_read), they are default actions
you've to create the message and add the action to the message
you've to add the message to your collection
It's kinda confusing, that on facebook 'actions' are the 3rd option under collection and message. But I guess you figured out already :)

Use built-in "Follow" action with a custom object type

How can I achieve such a thing? I have a custom object type - for example, a Club. I want users of my app to be able to Follow a Club, which has a manager that posts general club updates, etc. The two approaches I can come up with are:
A - Change my custom Club object type to use the built-in Profile object type.
B - Choose a synonym for Follow and try to get a custom action through the review process.
I already tried submitting as a custom Subscribe action and was rejected. Option A seems like I would be using the system against the way that it was designed to be used.
Clarification
I don't care about the user receiving facebook notifications or "following" the club in the facebook sense of the word. I just want to publish something to the user's timeline such as "Sammy followed a club on MyApp."
Facebook allows you to have a custom "Follow" action, but they don't make it obvious... for obvious reasons.
Create a custom action with a name other than follow
On the next page, change the name to follow
This is not sneaky in any way. After being rejected several times for synonymous actions like "track" and "subscribe" to try to work around the implied no-custom-follows limitation, it was finally suggested to me by the reviewer that I use the word "follow" for my custom action.

Drupal: customizing validation error messages

When the user submits a custom CCK form and a field marked as REQUIRED is empty, I get an xyz field is required..
How can I customize this message without modifying core modules?
Depending on the error message and how you need to change it, you may be able to use the String Overrides module to replace the string used to generate the message.
Another option is to create a custom module that overrides the validation function for a particular form or field, replacing any error messages with the messages of your choosing.

Resources