Notification by datalists in 5.0c
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 11:36 PM
Hi,
Is it possible to use Your script in Alfresco Community 5.0c:
<javascript>
var person=document.assocs["dl:dl:taskAssignee"][0];
var username=person.properties["{http://www.alfresco.org/model/content/1.0}userName"];
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiAdhoc";
workflow.parameters["bpm:workflowDescription"] = document.properties.title;
workflow.parameters["bpm:assignee"] = people.getPerson(username);
workflow.parameters["bpm:workflowDueDate"] = document.properties["dl:ganttEndDate"];
workflow.parameters["wf:notifyMe"] = true;
workflow.execute(document);
</javascript>
I copied Your script to Repository/Data Dictionary/Scripts and set a rule on all newly created items that executes this script (on TaskList folder) but it don't do anything.
In alfresco.global.properties i have system.workflow.engine.jbpm.enabled=false but changed workflowName to activity as shown in script.
Thanks for any tips
Is it possible to use Your script in Alfresco Community 5.0c:
<javascript>
var person=document.assocs["dl:dl:taskAssignee"][0];
var username=person.properties["{http://www.alfresco.org/model/content/1.0}userName"];
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiAdhoc";
workflow.parameters["bpm:workflowDescription"] = document.properties.title;
workflow.parameters["bpm:assignee"] = people.getPerson(username);
workflow.parameters["bpm:workflowDueDate"] = document.properties["dl:ganttEndDate"];
workflow.parameters["wf:notifyMe"] = true;
workflow.execute(document);
</javascript>
I copied Your script to Repository/Data Dictionary/Scripts and set a rule on all newly created items that executes this script (on TaskList folder) but it don't do anything.
In alfresco.global.properties i have system.workflow.engine.jbpm.enabled=false but changed workflowName to activity as shown in script.
Thanks for any tips
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 11:40 PM
This post was originally added to a two year old thread. While considering whether I should split it to its own topic, I accidentally clicked. Sorry about that.
You should probably link back to the script you were referring to.
You should probably link back to the script you were referring to.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2015 11:00 AM
I think there is a typo on the first line:
var person=document.assocs["dl:dl:taskAssignee"][0];
You have the namespace prefix duplicated. Change it to
var person=document.assocs["dl:taskAssignee"][0];
Try again and let me know if it works now.
var person=document.assocs["dl:dl:taskAssignee"][0];
You have the namespace prefix duplicated. Change it to
var person=document.assocs["dl:taskAssignee"][0];
Try again and let me know if it works now.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2015 12:42 PM
Yes typo would be the problem also. But I think I am not getting something here:
In my log I see:
18:37:44,775 ERROR [org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction1] Failed to execute asynchronous action: Action[ id=dca4df2c-d137-4d21-a979-571e3bca3dfe, node=workspace://SpacesStore/dca4df2c-d137-4d21-a979-571e3bca3dfe ]: TypeError: Cannot read property "0.0" from null (workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a#1)org.alfresco.scripts.ScriptException: 01020042 Failed to execute script 'workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a': 01020041 TypeError: Cannot read property "0.0" from null (workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a#1) at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:254) at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:237) at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:143) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:249) at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:209) at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:164) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy157.executeScript(Unknown Source) at org.alfresco.repo.action.executer.ScriptActionExecuter.executeImpl(ScriptActionExecuter.java:164) at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:265) at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:839) at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66) at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:265) at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:839) at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:739) at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:428) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:454) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:323) at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:437) at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119) at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88) at org.alfresco.repo.tenant.TenantUtil$1.doWork(TenantUtil.java:62) at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548) at org.alfresco.repo.tenant.TenantUtil.runAsUserTenant(TenantUtil.java:58) at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:440) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Caused by: org.alfresco.error.AlfrescoRuntimeException: 01020041 TypeError: Cannot read property "0.0" from null (workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a#1) at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:526) at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:250) … 43 moreCaused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "0.0" from null (workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a#1) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712) at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3725) at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1432) at org.mozilla.javascript.gen.workspace___SpacesStore_4163cbc3_15fe_4fd2_803c_869c5ac6a40a_22._c_script_0(workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a:1) at org.mozilla.javascript.gen.workspace___SpacesStore_4163cbc3_15fe_4fd2_803c_869c5ac6a40a_22.call(workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) at org.mozilla.javascript.gen.workspace___SpacesStore_4163cbc3_15fe_4fd2_803c_869c5ac6a40a_22.call(workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a) at org.mozilla.javascript.gen.workspace___SpacesStore_4163cbc3_15fe_4fd2_803c_869c5ac6a40a_22.exec(workspace://SpacesStore/4163cbc3-15fe-4fd2-803c-869c5ac6a40a) at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:502) … 44 more
I am not quite sure how it worked in earlier versions or what changed now.
Can You help ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2015 01:40 PM
It seems the document you are trying to get the dl:taskAssignee property actually doesn't have it.
Check if that association exists on the document.
Access it using Node Browser and look on its properties.
Check if that association exists on the document.
Access it using Node Browser and look on its properties.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2015 03:22 PM
Thank You! You were right I havent noticed that this should be association to issueAssignedTo
Here is full code od js script for that functionality. It notify user that has been assigned task to do with datalist (issueList).
Maybe it will be useful for someone.
Thank You once more!
Here is full code od js script for that functionality. It notify user that has been assigned task to do with datalist (issueList).
var person=document.assocs["dl:issueAssignedTo"][0];var username=person.properties["{http://www.alfresco.org/model/content/1.0}userName"];var workflow = actions.create("start-workflow");workflow.parameters.workflowName = "activiti$activitiAdhoc";workflow.parameters["bpm:workflowDescription"] = document.properties.title;workflow.parameters["bpm:assignee"] = people.getPerson(username);workflow.parameters["bpm:workflowDueDate"] = document.properties["dl:ganttEndDate"];workflow.parameters["wf:notifyMe"] = true;workflow.execute(document);
Maybe it will be useful for someone.
Thank You once more!
