02-15-2019 09:13 AM
Hello All,
I am new to Alfresco and i am trying to put a document inside a folder , but my folder is a variable so using "Publish to Alfresco task " is not going to work because the destination is fixed or at max you can define only 1 subfolder.
So i am thinking of using a listener at the end of my task execution and here is the code :
var test = execution.getVariable('DocumentPath');
var strDestFolder ="sites/swsdp/Projects";
var objDestFolder = companyhome.childByNamePath(strDestFolder);
test.move(objDestFolder);
the code is not working and i am having this error : org.activiti.engine.ActivitiException: problem evaluating script: ReferenceError: "companyhome" is not defined in <eval> at line number 3.
Any body can help me in fix this code ? or providing me with a solution to putting a document in a variable folder path ?
02-18-2019 12:12 AM
I think your script you have put is not correct it seems and something is undefined. like companyhome where this variable is declared or used.
02-18-2019 03:47 AM
Hello Tabrez,
I know that there is an issue with the code, i am not able to figure it out. I am searching for any solution to publish a document to a path i specify each time (variable folder path)
02-18-2019 04:20 AM
Are you trying to publish a document from APS or Embedded Activiti in Alfresco
for APS: you need to create a REST API (webscript) in alfresco which you can call from your APS, the script in alfresco should do the publishing.
for Embedded Activiti: you must use "org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate" class in `activiti:class` for accessing Alfresco root objects such as `companyhome`
02-19-2019 09:59 AM
Hello Abbas,
Thanks for the feedback , but i am trying to set a rule now.. and i am unable to get a specific property from a custom type i created
var name = document.properties["ptrojectname"]; it returns null any idea please?
02-20-2019 12:52 AM
do you see this property applied on the document in UI? probably the property is not available when you are trying to access it.
02-20-2019 02:51 AM
I am actually able to see it ...and it really is a weird behaviour , i put the property via APS.. and i can see it in the document...but when i try to show it , it doesnt work.
Explore our Alfresco products with the links below. Use labels to filter content by product module.