It's all about the answers!

Ask a question

IBM RTC CCM: java scripting, how to have identify diference between creation of WI vs. Modify

Rafael Rodriguez Montes (23013124244) | asked Jul 03 '19, 4:40 p.m.


I'm using javascript to gather field values and sending them to a external web service, but I need to know when is a new work item just recently created or an existing one that was modified, is there any attribute like state or something that can help me to identify when is a new WI or not? so far I can see the same values because when a new WI is created the ID is genered before the user populate, the state can be the same, so I'm not sure how can I make that difference of actions. 
Thank you. 

Accepted answer

permanent link
Ralph Schoon (63.0k33645) | answered Jul 04 '19, 1:37 a.m.
edited Jul 04 '19, 1:38 a.m.

 As far as I am aware it is very hard, up to impossible, to detect a state change in the JavaScript API. See . It might be possible to work around that by storing some data in a hidden attribute, but I would discourage to do that.

The JavaScript attribute customization is, for all I can tell not designed to drive such integrations and it should not be used for that. It can be called many times during working on a work item and it is not fit for the purpose.

If you want to write this kind of integrations, use the follow up action extension point in the RTC server API and write a participant. The participant can detect a state change, it can access all work item data and it is better performance wise.

Another option could be an asynchronous task, not sure about that. 

Rafael Rodriguez Montes selected this answer as the correct answer

Your answer

Register or to post your answer.