Attachment - how to access properties

cancel
Showing results for 
Search instead for 
Did you mean: 
mrahn
Active Member II

Attachment - how to access properties

Jump to solution

Dear community.

Using the Activiti App I wonder how I could access properties of attachments. Attachments seem to be of a complex datatype.

I would like to use a attachments name in a execution listener or task listener - writing it to variable (execution.setVariable ..).

Since I have no access to the Code (using the app only) and since documentation is VERY limited I need you help with this.

Marco

1 Solution

Accepted Solutions
cjose
Senior Member II

Re: Attachment - how to access properties

Jump to solution

Hi Marco,

I think I figured out the issue. The isVisible is getting overwritten by the visibility condition evaluation. So I decided to control this by adding a visibility condition which returns false. Please find attached a sample app with the updated scripts.

Ciju

View solution in original post

11 Replies
cjose
Senior Member II

Re: Attachment - how to access properties

Jump to solution

Hi Marco,

RelatedContentService relatedContentService & RelatedContentRepository relatedContentRepository beans might be what you are looking for here. Check if this post is of any help - Pass attachments to sub process (call activity) 

 

If you have a valid license, you should be able to request access to the Enterprise Repository Nexus Repository Manager which contains the java docs of all the enterprise libraries.

Hope this helps!

Regards,

Ciju

mrahn
Active Member II

Re: Attachment - how to access properties

Jump to solution

Hi Ciju.

.. Thanks so far!

As I am from the business side having just the Activiti APP but no access to the underlying Activiti ENGINE my possibilities are limited to what is achievable using the Activiti App.

Therefore I'd appreciate very much an example on how to adress an attachement using the Activiti App. I suppose it's not that difficult once I know how to address complex data types (like attachement).

Best regards

Marco

cjose
Senior Member II

Re: Attachment - how to access properties

Jump to solution

Understand. Can you please describe your use case of using a TaskListener /Execution Listener?

mrahn
Active Member II

Re: Attachment - how to access properties

Jump to solution

Hi Ciju.

.. you're right: I should explain the use case.

The process got a couple of user steps in a row (sequentially), each on assigned to a different assignee (group). Each assignee might attach files and see all files that have been attached in the steps before but must not delete attachments that have been added in a previous step.

Therefore I can't just use one "Attach File" form field since it allows deleting files. So I provide a separate "Attach File" form field for each step plus as many "Display value" form fields as steps have been before. The downside of this is that the "Display value" form field would always being displayed even if no attachment had been added in a previous step. In this case [empty] would be displayed. To hide "empty attachments" I'd like to check each "Display value" of the steps before. That is why I need to know how to adress an attachment/file object in the Execution/Task Listener.

This use case might sound not that thrilling but knowing how to adress the attachment properties would open possibilities for a couple of other use cases.

Best regards

Marco

cjose
Senior Member II

Re: Attachment - how to access properties

Jump to solution

Looks like it's more a UI side control that you need. You can achieve this using some java script.

Please find attached a sample app and see if this is what you are looking at. If yes, please look at the java script logic in the task form.

mrahn
Active Member II

Re: Attachment - how to access properties

Jump to solution

Hello Ciju.

Your Javascript-based solution seems to address the use case perfectly. But I suppose

viewfield.isVisible=false;

doesn't have the effect we expected.

.. see screenshot

Best Regards

Marco

cjose
Senior Member II

Re: Attachment - how to access properties

Jump to solution

Hello Marco,

Not sure what is happening here, it is working for me. Did you make any modifications to the app which I uploaded? Please attach your app so that I can check the java scripts and forms.

Ciju

mrahn
Active Member II

Re: Attachment - how to access properties

Jump to solution

Hi Cijua.

.. no, I did not modify your app .. just adding two missing semicolons

Marco

cjose
Senior Member II

Re: Attachment - how to access properties

Jump to solution

Hi Marco,

I think I figured out the issue. The isVisible is getting overwritten by the visibility condition evaluation. So I decided to control this by adding a visibility condition which returns false. Please find attached a sample app with the updated scripts.

Ciju