Coder Social home page Coder Social logo

Error: TF401320: Rule Error for field State. Error code: Required, HasValues, LimitedToValues, SetByRule, InvalidEmpty. about workitemupdater HOT 12 CLOSED

bluebasher avatar bluebasher commented on July 18, 2024
Error: TF401320: Rule Error for field State. Error code: Required, HasValues, LimitedToValues, SetByRule, InvalidEmpty.

from workitemupdater.

Comments (12)

BlueBasher avatar BlueBasher commented on July 18, 2024

It looks like there is some kind of rule or something configured that prevents the State field to be updated.
Can you please enable system.debug and copy the ouput from the WorkItemUpdater task here?

from workitemupdater.

jarz avatar jarz commented on July 18, 2024

Here's what I'm seeing in one build/release. I've got a separate team using the same process in VSTS and it's working.

2019-05-20T19:00:23.2291716Z ##[debug]Evaluating condition for step: 'Update Stories'
2019-05-20T19:00:23.2292385Z ##[debug]Evaluating: succeeded()
2019-05-20T19:00:23.2292564Z ##[debug]Evaluating succeeded:
2019-05-20T19:00:23.2292829Z ##[debug]=> True
2019-05-20T19:00:23.2293093Z ##[debug]Result: True
2019-05-20T19:00:23.2293336Z ##[section]Starting: Update Stories
2019-05-20T19:00:23.2441954Z ==============================================================================
2019-05-20T19:00:23.2442101Z Task         : WorkItem Updater
2019-05-20T19:00:23.2442217Z Description  : This task adds functionality to update WorkItems during a Build or Release.
2019-05-20T19:00:23.2442310Z Version      : 2.4.787
2019-05-20T19:00:23.2442400Z Author       : Blue Basher
2019-05-20T19:00:23.2442472Z Help         : 
2019-05-20T19:00:23.2442580Z ==============================================================================
2019-05-20T19:00:23.4558371Z ##[debug]agent.TempDirectory=D:\a\_temp
2019-05-20T19:00:23.4588643Z ##[debug]loading inputs and endpoints
2019-05-20T19:00:23.4596687Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2019-05-20T19:00:23.4606757Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2019-05-20T19:00:23.4609640Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2019-05-20T19:00:23.4612089Z ##[debug]loading INPUT_ALLWORKITEMSSINCELASTRELEASE
2019-05-20T19:00:23.4614178Z ##[debug]loading INPUT_LINKBUILD
2019-05-20T19:00:23.4616074Z ##[debug]loading INPUT_UPDATEASSIGNEDTO
2019-05-20T19:00:23.4617757Z ##[debug]loading INPUT_UPDATEASSIGNEDTOWITH
2019-05-20T19:00:23.4619395Z ##[debug]loading INPUT_WORKITEMCURRENTSTATE
2019-05-20T19:00:23.4621015Z ##[debug]loading INPUT_WORKITEMDONE
2019-05-20T19:00:23.4622723Z ##[debug]loading INPUT_WORKITEMKANBANSTATE
2019-05-20T19:00:23.4624653Z ##[debug]loading INPUT_WORKITEMSSOURCE
2019-05-20T19:00:23.4626335Z ##[debug]loading INPUT_WORKITEMSTATE
2019-05-20T19:00:23.4627896Z ##[debug]loading INPUT_WORKITEMTYPE
2019-05-20T19:00:23.4641545Z ##[debug]loading SECRET_AZURE_APP_SERVICE_KUDU_PRODUCTION_PASSWORD
2019-05-20T19:00:23.4643815Z ##[debug]loading SECRET_DBPASSWORD
2019-05-20T19:00:23.4650326Z ##[debug]loaded 17
2019-05-20T19:00:23.4671671Z ##[debug]Agent.ProxyUrl=undefined
2019-05-20T19:00:23.4673468Z ##[debug]Agent.CAInfo=undefined
2019-05-20T19:00:23.4673990Z ##[debug]Agent.ClientCert=undefined
2019-05-20T19:00:23.4674718Z ##[debug]Agent.SkipCertValidation=undefined
2019-05-20T19:00:23.6436597Z ##[debug]System.TeamFoundationCollectionUri=
2019-05-20T19:00:23.6445775Z ##[debug]SYSTEMVSSCONNECTION auth param AccessToken = ***
2019-05-20T19:00:23.6477168Z ##[debug]Build.BuildId=23271
2019-05-20T19:00:23.6477884Z ##[debug]System.TeamProjectId=
2019-05-20T19:00:23.6478325Z ##[debug]Build.RequestedFor=Tim
2019-05-20T19:00:23.6481994Z ##[debug]workitemsSource=Build
2019-05-20T19:00:23.6482319Z ##[debug]workitemsSourceQuery=null
2019-05-20T19:00:23.6484552Z ##[debug]allWorkItemsSinceLastRelease=true
2019-05-20T19:00:23.6485916Z ##[debug]workItemType=User Story
2019-05-20T19:00:23.6514816Z ##[debug]workItemState=Active
2019-05-20T19:00:23.6521936Z ##[debug]workItemCurrentState=Active,New
2019-05-20T19:00:23.6522138Z ##[debug]workItemKanbanLane=null
2019-05-20T19:00:23.6522259Z ##[debug]workItemKanbanState=DEV
2019-05-20T19:00:23.6522391Z ##[debug]workItemDone=true
2019-05-20T19:00:23.6535528Z ##[debug]linkBuild=false
2019-05-20T19:00:23.6570287Z ##[debug]updateAssignedTo=Never
2019-05-20T19:00:23.6571197Z ##[debug]updateAssignedToWith=Requester
2019-05-20T19:00:23.6571773Z ##[debug]assignedTo=null
2019-05-20T19:00:23.6572284Z ##[debug]addTags=null
2019-05-20T19:00:23.6575252Z ##[debug]removeTags=null
2019-05-20T19:00:23.6575782Z ##[debug]Release.ReleaseId=1528
2019-05-20T19:00:23.6576286Z ##[debug]Release.DefinitionId=1
2019-05-20T19:00:23.6578540Z ##[debug]Release.DefinitionEnvironmentId=1
2019-05-20T19:00:23.6578825Z ##[debug]BuildId 23271
2019-05-20T19:00:23.6579072Z ##[debug]ProjectId 
2019-05-20T19:00:23.6579322Z ##[debug]ReleaseId 1528
2019-05-20T19:00:23.6579553Z ##[debug]DefinitionId 1
2019-05-20T19:00:23.6579789Z ##[debug]DefinitionEnvironmentId 1
2019-05-20T19:00:23.6580026Z ##[debug]requestedFor Tim 
2019-05-20T19:00:23.6580257Z ##[debug]workitemsSource Build
2019-05-20T19:00:23.6580484Z ##[debug]workitemsSourceQuery null
2019-05-20T19:00:23.6580722Z ##[debug]allWorkItemsSinceLastRelease true
2019-05-20T19:00:23.6580959Z ##[debug]workItemType User Story
2019-05-20T19:00:23.6581175Z ##[debug]WorkItemState Active
2019-05-20T19:00:23.6581430Z ##[debug]workItemCurrentState Active,New
2019-05-20T19:00:23.6581670Z ##[debug]updateWorkItemKanbanLane null
2019-05-20T19:00:23.6581901Z ##[debug]WorkItemKanbanState DEV
2019-05-20T19:00:23.6582147Z ##[debug]WorkItemDone true
2019-05-20T19:00:23.6582370Z ##[debug]updateAssignedTo Never
2019-05-20T19:00:23.6582600Z ##[debug]updateAssignedToWith Requester
2019-05-20T19:00:23.6582818Z ##[debug]assignedTo null
2019-05-20T19:00:23.6583043Z ##[debug]addTags null
2019-05-20T19:00:23.6583271Z ##[debug]removeTags null
2019-05-20T19:00:23.6583496Z ##[debug]Get WorkItemTrackingApi
2019-05-20T19:00:23.8665751Z ##[debug]Get workItemsRefs
2019-05-20T19:00:23.8685799Z Using Release as WorkItem Source
2019-05-20T19:00:24.0002022Z ##[debug]Using Release 1503 as BaseRelease for 1528
2019-05-20T19:00:24.1328005Z ##[debug]Loop workItemsRefs
2019-05-20T19:00:24.1332709Z ##[debug]Found WorkItemRef: 15659
2019-05-20T19:00:24.2710875Z Found WorkItem: 15659
2019-05-20T19:00:24.2712032Z ##[debug]Setting assignedTo to requester for build "Tim".
2019-05-20T19:00:24.2721050Z ##[debug]Updating  WorkItem: 15659
2019-05-20T19:00:24.2721657Z Updating WorkItem 15659
2019-05-20T19:00:24.2724412Z ##[debug]Found KanbanLane: 
2019-05-20T19:00:24.2725888Z ##[debug]Found KanbanColumn: WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column,WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column
2019-05-20T19:00:24.2726601Z ##[debug]Found KanbanColumnDone: WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column.Done,WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column.Done
2019-05-20T19:00:24.2727872Z Patch: /fields/System.State Active
2019-05-20T19:00:24.2728775Z Patch: /fields/WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column DEV
2019-05-20T19:00:24.2729294Z Patch: /fields/WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column DEV
2019-05-20T19:00:24.2729791Z Patch: /fields/WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column.Done true
2019-05-20T19:00:24.2730260Z Patch: /fields/WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column.Done true
2019-05-20T19:00:24.2730820Z ##[debug]Start UpdateWorkItem
2019-05-20T19:00:24.3973991Z ##[debug]Caught an error in main: Error: TF401320: Rule Error for field State. Error code: Required, HasValues, LimitedToValues, SetByRule, InvalidEmpty.
2019-05-20T19:00:24.3974740Z ##[debug]task result: Failed
2019-05-20T19:00:24.4035788Z ##[error]Error: TF401320: Rule Error for field State. Error code: Required, HasValues, LimitedToValues, SetByRule, InvalidEmpty.
2019-05-20T19:00:24.4043980Z ##[debug]Processed: ##vso[task.issue type=error;]Error: TF401320: Rule Error for field State. Error code: Required, HasValues, LimitedToValues, SetByRule, InvalidEmpty.
2019-05-20T19:00:24.4044531Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: TF401320: Rule Error for field State. Error code: Required, HasValues, LimitedToValues, SetByRule, InvalidEmpty.
2019-05-20T19:00:24.4079870Z ##[section]Finishing: Update Stories

from workitemupdater.

jarz avatar jarz commented on July 18, 2024

Working with the AzD REST API, I eventually saw this for a "good" work item:

"System.State": "Resolved",
"WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column": "QA",
"WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column.Done": false,
"WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column": "Resolved",
"WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column.Done": false,

The story exists in two different team boards.

from workitemupdater.

RobertMcCoy avatar RobertMcCoy commented on July 18, 2024

@jarz What is the solution to this then? I'm not sure if the story exists in multiple boards, but if it does is there anyway to update only one of them?

from workitemupdater.

jarz avatar jarz commented on July 18, 2024

I don't think so @RobertMcCoy.

I ended up removing my team's stuff from the area paths used in the parent project's default board.

Are you seeing multiple values for KanbanColumn? I think that's the best indication that this is the cause.

Example:
2019-05-20T19:00:24.2725888Z ##[debug]Found KanbanColumn: WEF_DD9FE26FD0C242388F2F9F8D45CDE613_Kanban.Column,WEF_E60D60DB941D4C37A7B9BEB207E652DB_Kanban.Column

from workitemupdater.

jarz avatar jarz commented on July 18, 2024

const updatedWorkItem = await workItemTrackingClient.updateWorkItem(undefined, document, workItem.id);

A potential solution is to add bypassRules: true to tell Azure DevOps to ignore the inconsistency.

https://github.com/microsoft/azure-devops-node-api/blob/9ecc84ccfca7968b6ed8d5499c39d59a9e5ad8d2/api/WorkItemTrackingApi.ts#L90

It'd be best to have this be a checkbox on the task configuration in case people don't like breaking rules. ;)

from workitemupdater.

RobertMcCoy avatar RobertMcCoy commented on July 18, 2024

@BlueBasher Thoughts on the above being added to this codebase?

from workitemupdater.

BlueBasher avatar BlueBasher commented on July 18, 2024

Looks like a good change to add to the task. I'll try to add it this weekend.

from workitemupdater.

RobertMcCoy avatar RobertMcCoy commented on July 18, 2024

@BlueBasher Awesome. If you need someone else to take a stab at it or need assistance testing let me know. I haven't dev'd an extension before so my knowledge is a bit low, but I'm willing to help :)

from workitemupdater.

BlueBasher avatar BlueBasher commented on July 18, 2024

Implemented in PR #52

One side note: When enabling the bypassRules option I keep getting an error that the user doesn't have the permission to use bypassRules. I've set the Build account to have that permission but it still fails. Not sure if I have to set the bypassRules permission somewhere else though..
Since I get the permission error, the task itself works, is my educated guess.

from workitemupdater.

shayki5 avatar shayki5 commented on July 18, 2024

I also get the bypass rules permissions issue, even to me and yo the build user have this permission.
I got an error that the State is not in the values but he is... he have a rule in the transition that only who in a team can change but the build user and me exist in this team :/

from workitemupdater.

shayki5 avatar shayki5 commented on July 18, 2024

I figured out which user run the changes, is Project Collection Build Service (username) so we need to give to this user the bypass permissions :)

from workitemupdater.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.