It's all about the answers!

Ask a question

Is it possible to read an attached file from a javascript?


Michele Pegoraro (1.8k14119103) | asked Apr 16 '15, 6:53 a.m.
  Hi,
I'd like to create a calculated value script attribute customization. This script needs to read a file (a txt configuration file). Is it possible to attach this file to the process (in the process links) and read it from javascript?
Which url I can use to access it?

Thanks,
Michele.

Accepted answer


permanent link
Ralph Schoon (63.5k33646) | answered Apr 16 '15, 8:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
JavaScript provides a way to configure the attribute customization. This data is provided from the process configuration source by the framework. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Configuring_additional_script_pa
This should be used to configure the scripts, as it is the built in fastest method to do so.

Since JavaScript is run on the Client as well as on the server, you would need to use some mechanism based on html to access external data. It would likely have to be published by some Web Server similar to how the http filtered value provider uses such data.

Doing excessive customization using JavaScript, especially with accessing remote data, can crate performance issues and ruin it for the users.

Michele Pegoraro selected this answer as the correct answer

Comments
Michele Pegoraro commented Apr 16 '15, 11:07 a.m.

 The problem is that this configuration is too big to being included in process configuration (it is like a catalog) and we don't have external web server to publish it. I was supposing that having process attachments they could be accessed in some way, like a public url (as, I imagine, the icons)


Ralph Schoon commented Apr 16 '15, 11:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The icons are packaged in the Java Bundles.
I don't believe you can access a file, especially as you would need do be able to do that from the client as well as the server. I might be wrong, but it would likely a huge security breach, if you could.


1
Ralph Schoon commented Apr 16 '15, 11:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Should I add that, if the file is that big, it is probably a bad idea to try to load it every time the script is run?


Michele Pegoraro commented Apr 21 '15, 5:23 a.m.

Yes, you're definitely right. The best thing would be to create a provider service as you suggest but unfortunately we cannot do it. We'll resolve reading the file with a server side advisor, which is not what the user wants but it will be sufficient.

Thanks,
Michele.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.