I am attempting to work with files that have been attached in a form. How would I go about retrieving information within a JavaScript Script task? When I do a /activiti-app/api/enterprise/process-instances/${process_instance_id} call, I see that my variable for the attachment field = null, even when I have attached a document there.
I'm aware there is a relatedContentService, which requires some dependencies. Is there any way to check information (ANY information) on an attachment without leaving the BPMN editor?
Thank you
Greer Banks you need to use bpm_package in this way:
<code> var documents = bpm_package.children; </code>
Then you can loop through it to get those documents.
So I would still need to loop through the documents without being able to use it's ID from the form field? Because I can perform an api call to do the same thing, the issue is that documents are coming in in different orders based on what is attached.
yes you have to still loop through. Even in the bpm_package the order is not necessarily as attached by the users. I do not think you can use the document IDs from the form field directly in a workflow start page without having started the process. As the process goes, the documents attached are still "soft-links" and have no relation yet with the process at that stage; only when the process has successfully started do the documents have the workflow metadata attached to them.
Hope this explanation is helpful.
Happy coding.
The process would have been started by then. How can I access the metadata of the attachment form fields within a JavaScript?
What would I do then in the Alfresco Process Services runtime?
I am currently on vacation without access to the sources of the Alfresco Process Services project I am working on for one of my customers, so I cannot check if/how we dealt with that within scripts. I'd have to check how it is possible to access the Spring application context from withiin a script - with that you could access every Java services from scripts. I do this within Alfresco Content Services all the time and it's quite easy there via some static utilities, but have not had the need to do this with Process Services yet.
Last time I had to deal with related content (~4 weeks ago), I opted to write a Java-backed delegate since my delegate was intended to be reused in many process definitions (scripts or specifically script management in Process Services sucks with regards to reuse + testability).
When/if you are able, could you please provide an example where you were able to perform something like this within a Process Services script/listener? Thank you for your insight, Axel.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.