IBM RTC CCM: java scripting, how to have identify diference between creation of WI vs. Modify
HI,
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
As far as I am aware it is very hard, up to impossible, to detect a state change in the JavaScript API. See https://rsjazz.wordpress.com/2016/07/15/rtc-process-customization-what-you-can-and-cannot-do/ . 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.