It's all about the answers!

Ask a question

How to dynamically get the workitem url?


Vindhya Srinivasan (1111) | asked Sep 11, 2:16 a.m.

Hello,

I'm trying to get the url of a work item using the attribute customization (Calculated Values). However, I'm not able to get it with my dojo script. I'm basically trying to return the window.location.toString() to an HTML attribute created.
I'm able to print in my console the value of window.location.href but the same thing is not returned. The attribute is empty. 
In a nutshell, I'm trying to fetch the entire url of a workitem in RTC dynamically. I don't have any details such as the workitem ID, base URL, hostname etc.,

Can someone please help me out here?

One answer



permanent link
Davyd Norris (2.6k217) | answered Sep 11, 6:51 p.m.

Can you explain your actual end goal in detail? It sounds like you're going about things in a very complicated way and there may be a much more straightforward way to achieve this.


Comments
Ralph Schoon commented Sep 13, 2:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I agree with Davyd. The API is documented here: https://jazz.net/wiki/bin/view/Main/AttributeCustomization I summarized what I know here: https://rsjazz.wordpress.com/2022/11/25/ewm-attribute-customization-introduction/

You can access the ID of the work item, given that, you can create the URI of the work item It looks like: https://server:port/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/12345 for the work item with ID 12345.


Vindhya Srinivasan commented Sep 13, 3:00 a.m.

To be precise, I want my end result to be a URL which looks exactly like this: https://server:port/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/12345


For this, I'm trying to write a dojo script in the Calculated Values. I have created an attribute of type HTML and added an editor presentation for the same (type: HTML). Now, I want to populate this attribute's value from the calculated values dynamically. At this point, I don't have the workitem ID or the server details with me. I want to somehow fetch all these details of the workitem in some way to get the entire workitem url. Would this be possible to achieve with dojo scripts?


Davyd Norris commented Sep 13, 3:16 a.m.
What i asked was what is your goal, not what is the immediate thing you're trying to do. Why do you want this URL? What are you going to do with it?

The calculated script is for populating an attribute with a value - are you trying to populate it with a link? Because most of the attributes are protected and you won't be able to create a clickable link.

I ask again - what is your actual final goal in doing this?

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.