Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get URL of the current server dynamically in the dojo script?

Hello All,


We have a dojo script setup in IBM ELM to calculate a URL and it is configured in the process template under workitems. But the calculate URL has server URL hardcoded and we are getting the ID of the workitem dynamically. We want to get even the Server URL dynamically in the dojo script. 
Reason:
Currently while cloning data from production to quality server the dojo script is copied with production link since the URL is hard coded. 

Any code sample on how to get the server URL dynamically in dojo script of IBM ELM - would be helpful.

Thanks in advance!

1 vote



3 answers

Permanent link
If you're executing the script in the same server context, can you just leave out the server name and start with the root? So instead of:

https://<server>/ccm/blah
use 
/ccm/blah

Does that work?

0 votes


Permanent link
Hello Akilesh,
If you mean you want to get the server url importantly https://<server> part  try to fetch it from the creator attribute of the workitem.
workItem.getAttribute(WorkItemAttributes.CREATOR).getNullValue().webUri
Then you can match the part you require from the url related to creator details and filter hostname, baseurl or server key.

0 votes


Permanent link

This will always return the base URL of the server where your Dojo script is running.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 7,590
× 6,162
× 1,420
× 73
× 23
× 3

Question asked: May 15, 7:25 a.m.

Question was seen: 1,152 times

Last updated: Aug 25, 3:06 a.m.

Confirmation Cancel Confirm