I have a question for Alfresco Community v4.0.0
- I create content rule,
- select execute script,
- and in the script call processTemplate(ScriptNode template, array args)
How do I get an array into template? Args contains only key – value (String).
Thanks in advance for any advice or help
I think you’re getting something like “Expected extended hash. args.array evaluated instead to freemarker.template.SimpleScalar”, am I right?
If so, I’m afraid you can not get this working with scripts called from content rules, because there are no wrappers for complex datatypes, so this is the reason only String (and other scalars) is accepted.
You have two choices:
Alter alfresco code, which wraps objects and sends them into processTemplate() and build whole system (maybe more info on this you can find in my older blogpost)
Put an array into processTemplate() and in template read it like a string and then parse it – arrays looks like [val1,val2,val3], so refer to freemarker documentation for string functions and do something like this (ugly, but fast solution):
Edit: If anyone interested, I just raised a bug in Alfresco JIRA