How to modify the link type between two Work Items on action DONE

I have a Story with a linked child Task. I would like to "change" the relation between the Task and the Story during action DONE.
I know how to do the change in the process to have a script running during an action DONE, but I do not know how to get the link, remove it and create a new one using JAVA
Any example would be appreciated
Thank you
erwin
Accepted answer

Comments

See also https://jazz.net/library/article/1229

I always forget to look at your blog..
Thanks Ralph, I'll check you page and come back if I'm not able to do it :-)

I there now way to do it in Java Script as Scripted-based Calculated Value... like I did to enforce Remaining work to 0?

No.
The reason is JavaScript does not allow you to follow relationships. The JavaScript API does not know about links. Sorry.

Where you could look into could be http://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/. Not sure if you could do that in Java. The Java API you have available there is a bit richer, but still limited compared to a follow up action.

You have not to be sorry :-)
Me as old perl developer would have preferred to use Scripted-based stuff

There are discussions about API's provided. The issue is that if you wanted to use Perl, you would have to use REST/OSLC API's.
There are also discussions about making the JavaScript API richer.
But there is also a concern with respect to performance and users customize their tools so much that they render them unusable (and then blame the product).
Since the server API is in Java you have a lot more API available (dependent on the extension point). In addition you can also debug that relatively easy once you got through https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ .
My personal experience with scripting is that I like it as much as embedded c development without debugger back in the 80's. 8-)

Hi Ralph
How about just deleting the link to the Parent? Would that be possible with Scripted Based calculation

No this is also not accessible.Links are in general not accessible in Java Script, neither create, nor delete or follow.