How to fetch selected action to change status
I was reading other posts related and the attributes customization guide but still couldn't nail the problem here,
I want to trigger a java script to update the owner of a work item when I choose specific action from the drop down list to change from status A to status B. I'm not talking here when the work item is saved, just when you choose one specific value on the drop list to trigger the script So In the owner attribute definition I associated the calculated value with the the Java Script created, then I added a dependency on Status, but the script is not being called when I click on the status drop down list (to select the action I want). The other problem I have is that fecthing the STATE get's be the value of the work item's status that is already saved not the Action that I'm choosing from the drop down list my code is this dojo.provide("org.example.SetCheckingOwner"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("org.example.SetCheckingOwner", null, { getValue: function(attributeId, workItem, configuration) { if (workItem.getValue(WorkItemAttributes.TYPE) === "com.ibm.team.workitem.workItemType.test_wi" && workItem.getValue(WorkItemAttributes.STATE) === "TestWI.state.s6") { return workItem.getValue("devticket.owner"); } else { return workItem.getValue(WorkItemAttributes.OWNER); }} }); })(); Any help on this? |
3 answers
Hello,
not sure what you want to implement.
Please provide a concrete example, with steps.
with the values of owner, ticket owner, and what exactly is the behavior you want to implement.
I suspect you're trying to set the owner or ticket owner, when we switch to some new state.
Add some logging to your script, so you can not if it's called at all.
Thanks
|
Somme logging sample:
/*******************************************************************************
* Licensed Materials - Property of IBM * (c) Copyright IBM Corporation 2011. All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * Use, duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. *******************************************************************************/ dojo.provide("com.example.ValueProvider"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("com.example.ValueProvider", null, { getValue: function(attribute, workItem, configuration) { var status = workItem.getValue(WorkItemAttributes.STATE); console.log("State: " + status); var owner = workItem.getValue(WorkItemAttributes.OWNER); console.log("Owner: " + owner); var dev_ticket = workItem.getValue("dev_ticket_owner"); console.log("Ticket Owner: " + dev_ticket); if (status === "com.ibm.team.workitem.defectWorkflow.state.s2") { console.log("Ticket Owner"); return dev_ticket; } else { console.log("Owner"); return owner; } } }); })(); |
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.