Server Side Link Advisor - Validates Link and gets data from Linked WorkItem
I am attempting to write a server-side advisor using the 6.0.3 version of RTC with the server-sdk. I have two workItems that have a Parent/Child relationship. The advisor has two tasks: 1) Prevent the child from being saved unless it has been linked to a Parent of the correct workItem type. 2) Retrieve the WorkItem ID and the Owner of the Parent work item and populate these values into custom attributes of the Child Work Item. I am able to accomplish the first task, but am unable to determine how to resolve the link to get the ID and the Owner from the parent work item. my class extends AbstractService. my run method is as follows:
@Override
SaveParameter save = (SaveParameter)operation.getOperationData(); IAuditable auditable = save.getNewState();
if (auditable instanceof IWorkItem)
IWorkItem workItem = (IWorkItem)auditable;
Boolean parentFound = false;
for(IEndPointDescriptor endpoint: references.getTypes())
String endPointLinkID = endpoint.getLinkType().getLinkTypeId();
// This is where I am stuck.
if (!parentFound)
|
One answer
Ok so to answer my own question: https://rsjazz.wordpress.com/2012/12/14/do-not-modify-the-triggering-element-in-an-operationadvisor/ The advisor construct was never intended to update anything, only prevent the user from doing something that they are not allowed to do. The action of taking the ID and Owner values of the parent to the child work item will have to be done in a participant. |
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.