Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to create a script based on resolved state?

Hello,

I am trying to create an attribute condition based "Resolved" set state.

Could please somebody help me?

* I don't want to use "required attributes for Type and State", because, I'll need to have two conditions on same script (sev1 and resolved status). For Sev1, script is working fine, but for resolved status, nothing is happening.

current script (not working):

dojo.provide("ibm.cio.required.sev1H");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function()
{   
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("ibm.cio.required.sev1H", null, 
{  
matches:  function(workItem, configuration)
{      
var state = workItem.getValue(WorkItemAttributes.STATE);
return (state === "11");
// status = resolved
}
});
})(); 

--------------------

element details:

<option value="com.ibm.team.workitem.defectWorkflow.state.s11">Resolved</option>

Thanks!

0 votes

Comments
did you try with state === "com.ibm.team.workitem.defectWorkflow.state.s11"
( I did not try to run the script on my environment hence a quick check in comment)

Hi Don,


An update: Your State is working!!

It seems there was some issue on my server, and the updates made and saved on client were not being reflected as fast as normally is on UI/browser.

Thank you very much!

ps: I am not being able to mark your answer as the correct one, could you please convert your comment to answer (if possible) ? Or even let me know how can I mark your comment as the correct one.

->>Please ignore my previous comment below

Unfortunately, your state is not working either =(
I am still trying with other possible combinations, but with no success, so far.

If you have other suggestion, please let me know.

 https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_an_item_s_Status_attri explains states. If in doubt, debug or log the value of the attribute. 


Note, the state of the work item is the current state, you also get the workflow action in the condition. If the workflow action is not empty, the state of the item after the save will be the target state of the action.

Hi Ralph, thanks for your updates, two links you sent are very helpful!

I'll share my script as soon as I finish it in order to help others.

Thanks!



2 answers

Permanent link

 "Resolved" is a state group. I don't think state groups are available in the JavaScript attribute customization API. You have to code in all the states you consider resolved.

0 votes


Permanent link
Hello,

When associating Don's comment (https://jazz.net/forum/users/dyang) with my already saved script, the attribute condition is working fine. Please check below the current code:

Condition: Ticket must be a Sev1 and State moving from any one to Resolved.

------------------------------------------------------------------------------------------------

dojo.provide("org.example.workitems.providers.FinishedCondition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.FinishedCondition", null, {

      matches: function(workItem, configuration) {
          var state= workItem.getValue(WorkItemAttributes.STATE);
var sev =  workItem.getValue(WorkItemAttributes.SEVERITY);
          console.log(typeof(state))
          return((sev === "severity.literal.l5") && (state === "com.ibm.team.workitem.defectWorkflow.state.s11"));
// sev1
// resolved
      }
});

})();
------------------------------------------------------------------------------------------------

Thanks and best regards!

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,030

Question asked: Oct 11 '18, 6:56 p.m.

Question was seen: 1,973 times

Last updated: Oct 12 '18, 8:20 a.m.

Confirmation Cancel Confirm