It's all about the answers!

Ask a question

IBM RTC ccm work item java script, how detect or know when WI was created via OSLC vs Web interface


Rafael Rodriguez Montes (23013126247) | asked Jul 13 '19, 6:24 p.m.
edited Jul 13 '19, 7:31 p.m.

 Hello, 

I'm trying to trigger a specific behavior, but it will run only when the user opened the work item via web, not via oslc or rest or java, is there anyway to know where the source is comming? I know we can use the submitter user but, in my case does not apply. 
Thank you!

One answer



permanent link
Davyd Norris (2.2k217) | answered Jul 14 '19, 7:23 p.m.
The Work Item Proxy class is only available in the web client, and the same for the dojo libraries.

You can set up your JavaScript to check for either of these in order to work out if you're in the Web Client or somewhere else. Something like this should work:

if (typeof dojo.xhrGet === 'undefined') {
  console.log('We are not in the Web client any more, Toto');
} else {
  console.log('My spider senses are tingling! We are in the Web client');
}

Comments
Rafael Rodriguez Montes commented Jul 15 '19, 1:26 p.m. | edited Jul 15 '19, 1:28 p.m.

 hi it works when you trigger a custom attribute I mean when you put as dependent a custom attribute, but you but a dependent attribute that is non custom it doesn't work, is there any other way we can know?

Thank for all your help Davyd


Davyd Norris commented Jul 15 '19, 8:43 p.m.
What do you mean "it doesn't work" - can you state exactly what is happening?

Remember that if the code above is run on the server, you won't see anything in the web browser console (because it's running on the server!) - you'll see the message in the server logs instead.

Your answer


Register or to post your answer.