Attachement is back from "saveParameter.getNewState()" when Work Item attribute "Filed Against" set Teamarea.
Hi,
"saveParameter.getNewState()" return an attachment instance instead of work item instance at following condition.
- Custom plugin use " saveParameter.getNewState()" function.
- Custom plugin set in Project area's "Followup action".
- Work item attribute "Filed Against" set team area.
- Drug and Drop attachment file on work item, then error occur, can't save work item
"Filed Against" set project area, error not occurred, at drug and drop attachment file on work item.
Environment:
- EWM 7.0.2 iFix013
Thanks.
Accepted answer
This came in at some point and is still there.
Use the typical mechanism such as instanceof to make sure you get what you want.
E.g. make sure that the thing is what you expect. I f not, exit. For example:
/
* First check that the operation was a 'save' and get he operation
* data.
/
Object data = operation.getOperationData();
if (!(data instanceof ISaveParameter))
return;
ISaveParameter saveParameter = (ISaveParameter) data;
/*
* Check that this was a save operation on a work item
*/
IAuditable newState = saveParameter.getNewState();
if (!(newState instanceof IWorkItem)){
/*
* If not, we don't have to deal with it.
*/
return;
}</pre>