It's all about the answers!

Ask a question

Check if attachment is null in javascript


Chen Ben ezra (41427) | asked Dec 10 '15, 5:44 a.m.
edited Dec 10 '15, 7:01 a.m. by Ralph Schoon (63.6k33646)

 Hi , 

 

I created a new workitem.

In the editor presentation i defined attachments under the tab links , the attachment ID is:

com.ibm.team.workitem.presentation.attachments

I want to create a java script  that will check if the attachment is null or contain any value (I don't care which value it contain).

Is it possible ? (According to https://jazz.net/forum/questions/157309/how-to-get-attachment-file-name- of-a-work-item-in-a-customized-attribute ,  you can't access the attachments collection from JavaScript)

If it's possible in java script , how can i do it ? 

 

BR,

Chen

Accepted answer


permanent link
Ralph Schoon (63.6k33646) | answered Dec 10 '15, 5:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
For all I know you can not access attachments in JavaScript. Carefully read the description of what data you can access in JavaScript. You basically have access to specific work item attributes and attachments are not an attribute, really.
Chen Ben ezra selected this answer as the correct answer

Comments
Chen Ben ezra commented Dec 10 '15, 5:59 a.m. | edited Dec 10 '15, 8:40 a.m.

Thanks :)

One other answer



permanent link
xiaoqi zhang (11) | answered Jul 04, 8:07 a.m.

you can try this:

    workItem.getProxy().storedObject.linkTypes[0].linkDTOs.length


Comments
Ralph Schoon commented Jul 04, 10:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Thanks. But note that this is internal, not supported API. It also likely does not work in the Eclipse client.

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.