Multiple conditions on TFS field - tfs

I need to set a TFS field as required based on two conditions. For example i want to set the field state as required if
Field "IsValid" value is not true
Field "Test Type" value is "Analysis"
Is it possible to set multiple conditions in TFS?

Even if it sounds too late, here's a tip that worked for me. It's a little tedious so I'll try to be clear.
Here is my context :
First I'm working with TFS 2018 RTM (16.122.27102.1) but i don't think it's important in that case.
I added a new field : an "end user description" on User Stories or BUGs to generate a change log based on a simple query.
I wanted this HTML Field to be mandatory only when
the Work Item is "Closed"
the reason is "Work finished"
the activity is "Development"
a new boolean field "Ignore for change log" is not True
Workaround :
I created a new field : "Custom.EndUserDescriptionMandatory" (Integer).
The order is important.
The idea is that when a Field that plays on the condition is changed, that new field is set to 1.
After that when the value does not respond to the required condition, that new field is set to 0.
Here is the XML for the rules :
<FIELD name="Mandatory user description" refname="Custom.EndUserDescriptionMandatory" type="Integer">
<DEFAULT from="value" value="0" />
<WHENCHANGED field="Custom.ChangeLogIgnore">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="Custom.EndUserDescription">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="System.Reason">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="Microsoft.VSTS.Common.Activity">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENCHANGED field="System.State">
<COPY from="value" value="1" />
</WHENCHANGED>
<WHENNOT value="Closed" field="System.State">
<COPY from="value" value="0" />
</WHENNOT>
<WHENNOT value="Work finished" field="System.Reason">
<COPY from="value" value="0" />
</WHENNOT>
<WHEN value="true" field="Custom.ChangeLogIgnore">
<COPY from="value" value="0" />
</WHEN>
<WHENNOT value="" field="Custom.EndUserDescription">
<COPY from="value" value="0" />
</WHENNOT>
<WHENNOT value="Development" field="Microsoft.VSTS.Common.Activity">
<COPY from="value" value="0" />
</WHENNOT>
<HELPTEXT>(Internal use) allows to know whether Custom.EndUserDescription is mandatory or not</HELPTEXT>
</FIELD>
Finally I added a rule to the Workflow :
<STATE value="Closed">
<FIELDS>
<FIELD refname="Custom.EndUserDescription">
<WHENNOT value="0" field="Custom.EndUserDescriptionMandatory">
<REQUIRED />
</WHENNOT>
</FIELD>
</FIELDS>
</STATE>
I hope that will help.

In simple terms: It's not supported now.
Here has been a featured request in Voice of VS. You can also vote for it.
Allow nested when, whennot, whenchanged, and whennotchanged in TFS
work item definitions
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/5760933-allow-nested-when-whennot-whenchanged-and-whenn

Related

How to set a default field value in some form view in Odoo?

How to set default value in Job_id in this form with xml and don't need to set in the python file?
<record id="form_student_stu" model="ir.ui.view">
<field name="name">Student Info</field>
<field name="model">youth_and_scholarship.youth_and_scholarship</field>
<field name="arch" type="xml">
<form string="Job Form" version="9.0">
<div class="widget_box">
<div class="widget_title"><h5>Student Information</h5></div>
<div>
<group col="1">
<field name="image" widget="image" class="oe_avatar oe_left" nolabel="1"/>
<field name="Job_id" invisible="1"/>
</group>
<group>
<field name="Kname" placeholder="First Name and Last Name..." string="Name in Khmer" style="width:40%%"/>
<field name="Ename" placeholder="First Name and last Name..." string="Name in Latin" style="width:40%%"/>
<field name="Gender" string="Gender" style="width:40%%"/>
<field name="DOB" string="Date of birth"/>
<field name="Job_work" string="Accupation" style="width:40%%"/>
</group>
</div>
</div>
</form>
</field>
</record>
You can use some context specifying an XML ID (External ID). You can add the default value to the action which calls the view like this:
<record id="youth_and_scholarship_youth_and_scholarship_action" model="ir.actions.act_window">
<field name="name">Student Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">youth_and_scholarship.youth_and_scholarship</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_job_id': ref('xml_id')}</field>
</record>
If you open the view from a field, from a many2one for example, you can add the context to that field:
<field name="field_name" context="{'default_job_id': ref('xml_id')}" />
If haven't set the XML ID of the record you can get the ID by Python code and return an action window with the context:
job_id = self.get_job_id()
return {
'name': 'Student Info',
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'youth_and_scholarship.youth_and_scholarship',
'context': {'default_job_id': job_id }
}
NOTES:
The key always has to be: default_ + field_name: database_id
You can see all the XML IDs here: Settings > Technical > Sequences & Identifiers > External Identifiers > Complete ID

Quickfixj 1.5.x/1.6.x custom message with repeating group - compilation issue

i am trying to add a custom message and compile quickfixj and am running into an issue where last few fields that i've added are not being picked up (they all have field number > 93000 if it matters)
code generation is ok but compilation fails, i am sure i am missing something obvious, searched for similar issues reported by others but didn't find any, can someone please help
#
public static class NoAccounts extends Group {
static final long serialVersionUID = 20050617;
private static final int[] ORDER = {1, 51006, 90002, 90003, 51005, 90001, 93000, , , , , , , 0};
#
Here is what i've added
<message name="GetAccountsRsp" msgtype="UsE" msgcat="app">
<field name="RequestId" required="Y"/>
<field name="ResponseStatus" required="N"/>
<field name="ErrorMessage" required="N"/>
<component name="AccountGrp" required="N"/>
<field name="Bookmark" required="N"/>
<field name="LastFragment" required="Y"/>
</message>
<component name="AccountGrp">
<group name="NoAccounts" required="N">
<field name="Account" required="N"/>
<field name="RiskNodeID" required="N"/>
<field name="Name" required="N"/>
<field name="AutomaticMoveAccountId" required="N"/>
<field name="Owner" required="N"/>
<field name="JSCCAccountType" required="N"/>
<component name="AccountExtension" required="N"/>
</group>
</component>
<component name="AccountExtension">
<field name="JpxAccountType" required="N"/>
<field name="IsOmnibus" required="N"/>
<field name="IsGross" required="N"/>
<field name="ClientId" required="N"/>
<field name="TradingMemberId" required="N"/>
<field name="ClearingMemberId" required="N"/>
<field name="IsConcentration" required="N"/>
</component>
<field number="50007" name="Bookmark" type="STRING"/>
<field number="50025" name="RequestId" type="STRING"/>
<field number="51005" name="Owner" type="STRING"/>
<field number="51006" name="RiskNodeID" type="STRING"/>
<field number="51009" description="ClearingMemberId" type="STRING" />
<field number="51011" description="TradingMemberId" type="STRING" />
<field number="51015" name="ResponseStatus" type="STRING">
<value enum="0" description="ACCEPTED" />
<value enum="1" description="REJECTED" />
</field>
<field number="51016" name="ErrorMessage" type="STRING"/>
<field number="51019" name="NoAccounts" type="NUMINGROUP"/>
<field number="90001" name="JSCCAccountType" type="STRING">
<value enum="1" description="DEFAULT_CLEARING_HOUSE" />
<value enum="2" description="CLEARING_HOUSE" />
<value enum="3" description="NORMAL" />
<value enum="4" description="CONCENTRATION" />
</field>
<field number="90002" name="Name" type="STRING"/>
<field number="90003" name="AutomaticMoveAccountId" type="STRING"/>
<field number="93000" name="JpxAccountType" type="STRING">
<value enum="1" description="HOUSE_ACCOUNT_TYPE" />
<value enum="2" description="AFFILIATE_ACCOUNT_TYPE" />
<value enum="3" description="CLIENT_ACCOUNT_TYPE" />
</field>
<field number="93001" description="IsOmnibus" type="BOOLEAN">
<value enum="N" description="FALSE"/>
<value enum="Y" description="TRUE"/>
</field>
<field number="93002" description="IsGross" type="BOOLEAN">
<value enum="N" description="FALSE"/>
<value enum="Y" description="TRUE"/>
</field>
<field number="93003" description="ClientId" type="STRING" />
<field number="93015" description="IsConcentration" type="BOOLEAN">
<value enum="N" description="FALSE"/>
<value enum="Y" description="TRUE"/>
</field>
<field number="96005" name="ContractPeriod" type="INT"/>
please ignore, stupid error, I've added 'description' attribute instead of 'name' attribute to the new fields I've added, when I include in group/component source is generated without these causing an issue during compilation. lesson learned - double check dictionary to avoid issues during recompilation

Adding columns to scrum board

I am using TFS2013 and have spent a lot of effort editing the Task WIT process to allow two new states for my tasks... "Testing" and "Blocked"... I have edited the Task.xml file on the server and successfully added the two new states and the valid transitions to and from these states.
The states do show up when editing a task and the flow to and from the new states seem to work fine.
The problem is I cannot figure out how to add these new states as swimlanes on the task board. All of the Microsoft documentation states the columns are defined by the process states.
Please not this is the "In-Sprint" task board... NOT the Kanban board (that one is easy to edit)
Here is the XMl that I have added to the Task WIT Xml :
<STATE value="Testing">
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ClosedDate">
<EMPTY />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ClosedBy">
<ALLOWEXISTINGVALUE />
<EMPTY />
</FIELD>
</FIELDS>
</STATE>
<STATE value="Blocked">
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ClosedDate">
<EMPTY />
</FIELD>
<FIELD refname="Microsoft.VSTS.Common.ClosedBy">
<ALLOWEXISTINGVALUE />
<EMPTY />
</FIELD>
</FIELDS>
</STATE>
......
<TRANSITION from="Active" to="Testing">
<REASONS>
<DEFAULTREASON value="Development Completed" />
</REASONS>
</TRANSITION>
<TRANSITION from="Testing" to="Closed">
<REASONS>
<DEFAULTREASON value="Testing Passed" />
</REASONS>
</TRANSITION>
<TRANSITION from="Testing" to="Active">
<REASONS>
<DEFAULTREASON value="Testing failed - Fixing" />
</REASONS>
</TRANSITION>
<TRANSITION from="Testing" to="New">
<REASONS>
<DEFAULTREASON value="Testing failed - Ready for fix" />
</REASONS>
</TRANSITION>
<TRANSITION from="Active" to="Blocked">
<REASONS>
<DEFAULTREASON value="Impediment Encountered" />
</REASONS>
</TRANSITION>
<TRANSITION from="Blocked" to="Active">
<REASONS>
<DEFAULTREASON value="Impediment Removed" />
</REASONS>
</TRANSITION>
<TRANSITION from="Blocked" to="Closed">
<REASONS>
<DEFAULTREASON value="Closed due to Impediment" />
</REASONS>
</TRANSITION>
Have you added the new states to the process configuration?
If you use "witadmin exportprocessconfiguration" you can add your additional stated to the column mapping. You need to tell TFS wither those states should allign to "ToDo", "InProgress", or "Done" modes.
Once you have modified and uploaded this it should work.

TFS2013 Requiring Comments on transitions to certain states

I'm creating a TFS 2013 Kanban board. I want to require an additional comment when the user switches the State to "Blocked From Progress"
Based on this post (http://social.msdn.microsoft.com/Forums/vstudio/en-US/9b672f4c-3054-481a-856d-4da650f25f74/how-to-require-comments-during-state-transition?forum=tfsprocess) I can require comments on all state changes. How do I limit it to just a transition to the "Blocked From Progress" State? Here's a section of code from my exported User Story xml file:
<FIELD name="HistoryHelper" refname="Demo.HistoryHelper" type="String">
<WHENNOT field="System.State" value="Blocked From Progress">
<COPY from="value" value="1" />
</WHENNOT>
<WHEN field="System.History" value="">
<COPY from="value" value="0" />
</WHEN>
<WHENNOT field="System.History" value="">
<COPY from="value" value="1" />
</WHENNOT>
<WHENCHANGED field="System.State">
<PROHIBITEDVALUES>
<LISTITEM value="0" />
</PROHIBITEDVALUES>
</WHENCHANGED>
</FIELD>
This is almost exactly the code from the above link, but I've added a check for the value of the State. Those lines don't seem to change the behavior at all. I've tried them at different places in the XML to no avail. Also, I've tried nesting a inside a and got errors. I don't know if there's a way to do an AND inside a WHEN.
EDIT
In addition to the accepted answer, I updated the new Field definition to be as follows:
<FIELD name="Blocked Reason" refname="CustomerProjects.BlockedReason" type="HTML" >
<WHENNOT field="System.State" value="Blocked From Progress">
<COPY from="value" value="" />
<READONLY />
</WHENNOT>
</FIELD>
I think a good solution for this would be to create a new field called "Blocked Reason" and then make it required on transitions into the "Blocked From Progress" state. You'd implement this like:
<Fields>
...
<FIELD name="Blocked Reason" refname="<company>.BlockedReason" type="HTML" />
...
</FIELDS>
<WORKFLOW>
...
<TRANSITIONS>
...
<TRANSITION from="<somestate>" to="Blocked From Progress">
...
<FIELDS>
<FIELD refname="<company>.BlockedReason">
<REQUIRED />
</FIELD>
</FIELDS>
</TRANSITION>
...
</TRANSITIONS>
...
</WORKFLOW>
You'd need to set that for each possible transition into the "Blocked From Progress" state. If you wanted you could also remove the text from the field using the tag on transitions out of the "Blocked From Progress" state.

Change the selection state of the litstbox item when a user clicks on a button (ZK 3.6.4)

I'm working in a project with ZK 3.6.4. but I have a problem, I want to change the selection state of the litstbox item when a user clicks on a button inside the same listbox ( same listitem)., because I want to know the selectedItem. I was reading zk documentation and I can do it , but with Zk version 5.0.5+ (nonselectableTags). But I cannot change for this version for project rules. So, there are a way to emulate this behavior with 3.6.4? or what kind of advices can you give me to do this? I really appreciate your help.
Here the code that I have.
<listbox
id="listDocAcads" mold="paging" pageSize="2"
model="#{win$composer.academicCollections}"
selectedItem="#{controller.docEntAcad}" >
<listhead>
<listheader
width="30%" label="Name" />
<listheader
width="15%" label="amount" />
<listheader
width="15%" label=" delivered?" />
<listheader
width="20%" label="Importance" />
<listheader
width="20%" label="Document" />
</listhead>
<listitem
self="#{each='docAcad'}" value="docAcad"
style="border:none;">
<listcell
label="#{docAcad.colleByProcess.oDocument.name}" />
<listcell
label="#{docAcad.colleByProcess.amount}" />
<listcell>
<spinner
width="60%" value="#{docAcad.amount}" />
</listcell>
<listcell
label="#{docAcad.colleByProcess.oImportance.name}" />
<listcell ><button id="btnUploadDocument" label="Upload"/> </listcell>
</listitem>
</listbox>
if you want to ignore button and input's u can do this.
nonselectableTags="button, input".
<listbox nonselectableTags="button, input">
<listitem><listcell><textbox/></listcell></listitem>
<listitem><listcell><button label="button"/></listcell></listitem>
<listitem><listcell><h:input xmlns:h="native"/></listcell></listitem>
<listitem><listcell><datebox/></listcell></listitem>
</listbox>
the values to nonselectableTags should be HTML tags separated by comma.
Hope this helps!

Resources