MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
56 stars 14 forks source link

Issue with Swimlane/Kanban attribute #148

Closed cbrabin closed 2 years ago

cbrabin commented 2 years ago

We are trying to create a Work Item and set the Swimlane via the Create Work Item task. We put in our Swimlane field but nothing happens. The task works and creates the Item but just sets it in the top swimlame.

1) The attribute pick list does not see this field. 2) We can make it work in the API directly via the Json response using the same values.

Are we just not calling it correctly or is this functionality missing from the task.

Any help would be apricated

ReneSchumacher commented 2 years ago

Hi @cbrabin,

you mentioned that you can create a work item with the correct swimlane using the API. Can you describe how you do that? Everything related to the Kanban boards is complicated because the information is not stored in regular work item fields. Since board configuration always depends on a team, an item that is in column A for team T1 can at the same time be in column B for team T2. Therefore, there are a couple read-only fields (System.BoardColumn, System.BoadColumnDone, System.BoardLane) which are dynamically evaluated during work item queries depending on the team for which the query runs.

The actual information is stored in what we call extension fields with reference names similar to WEF_4E8EFA1942384BC3856B5E64506F5934_Kanban.Column. Those fields are not listed as regular fields as they are "attached" to the work item as needed. I haven't spent much time investigating how those extension fields work in detail and would need to do some research to see if we can really set those at work item creation time.

cbrabin commented 2 years ago

Hi

Thank you for replying. We really like using this tool as its easy than tyring to create the Json for the call.

Below is the PowerShell we were using and that does out the work item in the correct Swimlane.

$NowTime = Get-Date -Format "dd/MM/yyyy" $pacToken = $(pacToken) $organizationName = "deloitteukits" $projectName = $(AreaPath) $Title = "$(TaskTitle) - $NowTime" $description = $(description) $Tag1 = $(Tag1) $priority = $(Priority) $Assign = $(Assign) $state = $(state) $AreaPath = $(AreaPath) $swimlane = $(swimlane) $TimeWorkedOn = $(TimeWorkedOn)

$adoHeader = @{Authorization=("Basic {0}" -f [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "",$pacToken))))} $adoUserStoryUri = "https://dev.azure.com/$organizationName/$projectName/_apis/wit/workitems/`$User Story?api-version=5.1"

$comments = $description $comments = $comments.replace('"',"'")

$body="[ { "op": "add", "path": "/fields/System.Title", "value": "$title" }, { "op": "add", "path": "/fields/System.Description", "value": "$comments" }, { "op": "add", "path": "/fields/Microsoft.VSTS.Common.Priority", "value": "$priority" }, { "op": "add", "path": "/fields/System.AssignedTo", "value": "$Assign" }, { "op": "add", "path": "/fields/System.State", "value": "$State" }, { "op": "add", "path": "/fields/System.Tags", "value": "$Tag1;$Tag2" }, { "op": "add", "path": "/fields/Custom.TimeWorkOn", "value": "$TimeWorkedOn" },

{ "op": "add", "path": "/fields/System.AreaPath", "value": "$AreaPath" },

   {
`"op`": `"add`",
`"path`": `"/fields/WEF_4BE4D0E95994484C8FBFC7D9B80D97DD_Kanban.Lane`",
`"value`": `"$swimlane`"

}

]"

$Result = Invoke-RestMethod -Uri $adoUserStoryUri -ContentType "application/json-patch+json" -Body $body -headers $adoHeader -Method POST

Write-Output $Result.id

Christopher Brabin Manager | Technology & Digital Services | Deloitte LLP D: +44 20 7303 7118 | M: +44 7785 292661 @.**@.> | www.deloitte.co.uk

From: René Schumacher @.> Sent: 13 July 2021 14:33 To: MicrosoftPremier/VstsExtensions @.> Cc: Brabin, Chris @.>; Mention @.> Subject: [EXT] Re: [MicrosoftPremier/VstsExtensions] Issue with Swimlane/Kanban attribute (#148)

Hi @cbrabinhttps://secure-web.cisco.com/1KNuqP1Udkiw49XWhpb8gN6E2FqSY6pyUAHVvvoUGaSo_HUUWdGNwUCaI0--yOE-HDI6iK5fjvRmWYE8bqo74p7M_GUJn7IdPFmdTO3hKNH6it8uXb4zFj10r6vNvFFnDQMl9X2QkjzT1KIz57eDzGa9pKAmlSG-kw9hTx1342pAbrn3OogMMdwWZv23ZP55CwDARghyASDDuzguPQGrkIfi6a47zRFIEqLilUVWlTkIuQwtecttPlcdX9VcqDnPUvEHLWXsFCRxU6oZW8GYUienUd2rJdEC0EtnPKENr_34BsxDDfEMJ8j_4Xxzr9xL6/https%3A%2F%2Fgithub.com%2Fcbrabin,

you mentioned that you can create a work item with the correct swimlane using the API. Can you describe how you do that? Everything related to the Kanban boards is complicated because the information is not stored in regular work item fields. Since board configuration always depends on a team, an item that is in column A for team T1 can at the same time be in column B for team T2. Therefore, there are a couple read-only fields (System.BoardColumn, System.BoadColumnDone, System.BoardLane) which are dynamically evaluated during work item queries depending on the team for which the query runs.

The actual information is stored in what we call extension fields with reference names similar to WEF_4E8EFA1942384BC3856B5E64506F5934_Kanban.Column. Those fields are not listed as regular fields as they are "attached" to the work item as needed. I haven't spent much time investigating how those extension fields work in detail and would need to do some research to see if we can really set those at work item creation time.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/17SiiqheeefK3Sthc-gmxxwZKgA7Dlmrp8w620LUO7RTMm-x4pyKBrnCh5F5MjKcJY07CrdSYv0odeZnq_1i2xvc7qkoEWsIhmrGmNekmcRKL8QNpM4g4zehcGk4AqLYsvMpBcWMipNJL0R4uXehduKXgliZIpQnEMicK84I5rAj5eSo-75w5y8LYIJ-uxJUXhkPPXwGTpt-9Fadrcg7I227pEO-eY2lLRDJwCAY7S0_Lvd-zTPDI_nagNxWjj29S47bGBFBxd2Am68znVEMJjwW139J543x7crnnB4S6ICCwuOj0mJCCbEzAhbJPgJHO/https%3A%2F%2Fgithub.com%2FMicrosoftPremier%2FVstsExtensions%2Fissues%2F148%23issuecomment-879091629, or unsubscribehttps://secure-web.cisco.com/1k9uNJPvAe_EDeEDDyVgNsvwLHxBzt4Tx3bPHcYoHkMLsNrWUtzfIcNVzRT5MVshJnZ2spkDiQSv7HAyJ4fWGxT0DgkJEaJFV9YI9OkEQ2D-27kKliCr0Ql0qOzydKfJvJrQG5jc-oPrjBpv4QkowKraVpAgLwJM58dvWPzlesaUMv9ukIY5I-61BuCfWeDugIMokgjsR6DE8NV5uN7gIZInXNMOCfuleEnX2J9B_YSTRorVUgYPA5Sc4XNRc4lz3tLFQvnzada-uRS60dasLnIwpjMtA_h-bXtw01IY81n4EvdbyCsuu-Ie_OdxP7hqt/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAU2FKQ47ZOQ7AAWVCV5KPHLTXQ57ZANCNFSM5AGZZ3AQ. IMPORTANT NOTICE

This communication is from Deloitte LLP, a limited liability partnership registered in England and Wales with registered number OC303675. Its registered office is 1 New Street Square, London EC4A 3HQ, United Kingdom. Deloitte LLP is the United Kingdom affiliate of Deloitte NSE LLP, a member firm of Deloitte Touche Tohmatsu Limited, a UK private company limited by guarantee (“DTTL”). DTTL and each of its member firms are legally separate and independent entities. DTTL and Deloitte NSE LLP do not provide services to clients. Please see www.deloitte.co.uk/abouthttps://www.deloitte.co.uk/about to learn more about our global network of member firms. For details of our professional regulation please see Regulatorshttps://www2.deloitte.com/uk/en/footerlinks1/regulators-and-provision-service-regulations.html.

This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please notify @.**@.> and destroy this message immediately. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a @deloitte.co.uk email account are securely archived and stored by an external supplier within the European Union.

You can understand more about how we collect and use (process) your personal information in our Privacy Noticehttps://www2.deloitte.com/uk/en/legal/privacy.html.

Deloitte LLP does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a Deloitte LLP engagement contract.

Opinions, conclusions and other information in this email which have not been delivered by way of the business of Deloitte LLP are neither given nor endorsed by it.

ReneSchumacher commented 2 years ago

Thanks for posting your PowerShell script. As I see, you found the correct extension field and set it as part of the REST POST. This would work in our task if we didn't do a check of the field name against all existing fields. Since extension fields are not listed as regular work item fields, the task simply ignores that mapping. If you enable debug mode (setting System.Debug to true), you'll see a debug message like this:

##[debug]Work item field 'WEF_4889BBF78C1B46F1B327A719E87DD8D1_Kanban.Column' does not exist.
##[debug]Invalid field name in mapping string 'WEF_4889BBF78C1B46F1B327A719E87DD8D1_Kanban.Column=Review'. Mapping will be ignored.

I'd like to add support for board fields to the task, but I believe this will take until end of the week to get it implemented. My idea is to allow a special field mapping syntax similar to this: <team name or id>:<board name or id>:<Column|Lane|Column.Done>=<value>. An example mapping would look like this: MyTeam:Backlog Items:Column=MyCustomColumn.

Since we can only create work items in their initial state, this would only work for board columns that are linked to the initial work item state, though. Would that meet your needs?

cbrabin commented 2 years ago

Hi

Thank you again for your quick response . We only require this to work on the initial creation of the work item so I think this would work for us.

Thank you again for looking at the issue.

Christopher Brabin Manager | Technology & Digital Services | Deloitte LLP D: +44 20 7303 7118 | M: +44 7785 292661 @.**@.> | www.deloitte.co.uk

From: René Schumacher @.> Sent: 13 July 2021 15:44 To: MicrosoftPremier/VstsExtensions @.> Cc: Brabin, Chris @.>; Mention @.> Subject: [EXT] Re: [MicrosoftPremier/VstsExtensions] Issue with Swimlane/Kanban attribute (#148)

Thanks for posting your PowerShell script. As I see, you found the correct extension field and set it as part of the REST POST. This would work in our task if we didn't do a check of the field name against all existing fields. Since extension fields are not listed as regular work item fields, the task simply ignores that mapping. If you enable debug mode (setting System.Debug to true), you'll see a debug message like this:

[debug]Work item field 'WEF_4889BBF78C1B46F1B327A719E87DD8D1_Kanban.Column' does not exist.

[debug]Invalid field name in mapping string 'WEF_4889BBF78C1B46F1B327A719E87DD8D1_Kanban.Column=Review'. Mapping will be ignored.

I'd like to add support for board fields to the task, but I believe this will take until end of the week to get it implemented. My idea is to allow a special field mapping syntax similar to this: ::<Column|Lane|Column.Done>=. An example mapping would look like this: MyTeam:Backlog Items:Column=MyCustomColumn.

Since we can only create work items in their initial state, this would only work for board columns that are linked to the initial work item state, though. Would that meet your needs?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/10m1CYQib6VRQti1CQMkI9AtJdwqpYLHOy_28AxMf7q3e_ZqZ0RP9YnWV_0kY0T_Qfrug3nP3Za3voLFPSsy3yMDTMfH3azl5jCjh9nRDCOGvWb8__R3t6Jj4dyXXfx4sAxYr6ECPFI0pbojFDYTP2qzbSHXydtTT7MgnpZ50V8PV0tOEKps8vy4_d7h_1z3Acpws_fYjBY-YkLIv86DwOzWDjrM4gHAIiX059k4dIftPmW6Yk6IWrk28ygWUWYfsAnar7Fyquu9ZudI_c4iHI4JdTdCqswl4-aY60fAEGa_VHoQbRT_46FCWhoz_PasUBh2KeUvJGjN9CZf89AZ4Bw/https%3A%2F%2Fgithub.com%2FMicrosoftPremier%2FVstsExtensions%2Fissues%2F148%23issuecomment-879149711, or unsubscribehttps://secure-web.cisco.com/1J6twtHZdQqzSJBxbxfOiDu5mXv2DtZ1UK9ptg8M-E4J5WqR2uAOOs3VkZatGHBW1yVh2HeS-x8axT5ZZX_0CUiP2orF0YwhzYm5s_CtHUeoJMatYxc6rIdhjLd5G937zJlPa-XuE8R77gruRC1km9mKiuESZpMClXGeonMiL0nEbQ153dLV8LklF0NzMp3qaYXvJtzKG3CcpNuAXb158MpQrMmx1E6726ZklbiAz0C-_I6wms3UlbEREEzP6dk1qH3-LMon2bqCnUdrG4e7QxCvEPs7gLRHi8_kR1KEPWqUgbA3uHNlPQakmUS-U6xMSh0oqxYC1Nrag2JXbQMZuyA/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAU2FKQ67ZS3VGWEVHTR6UODTXRGJHANCNFSM5AGZZ3AQ. IMPORTANT NOTICE

This communication is from Deloitte LLP, a limited liability partnership registered in England and Wales with registered number OC303675. Its registered office is 1 New Street Square, London EC4A 3HQ, United Kingdom. Deloitte LLP is the United Kingdom affiliate of Deloitte NSE LLP, a member firm of Deloitte Touche Tohmatsu Limited, a UK private company limited by guarantee (“DTTL”). DTTL and each of its member firms are legally separate and independent entities. DTTL and Deloitte NSE LLP do not provide services to clients. Please see www.deloitte.co.uk/abouthttps://www.deloitte.co.uk/about to learn more about our global network of member firms. For details of our professional regulation please see Regulatorshttps://www2.deloitte.com/uk/en/footerlinks1/regulators-and-provision-service-regulations.html.

This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please notify @.**@.> and destroy this message immediately. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a @deloitte.co.uk email account are securely archived and stored by an external supplier within the European Union.

You can understand more about how we collect and use (process) your personal information in our Privacy Noticehttps://www2.deloitte.com/uk/en/legal/privacy.html.

Deloitte LLP does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a Deloitte LLP engagement contract.

Opinions, conclusions and other information in this email which have not been delivered by way of the business of Deloitte LLP are neither given nor endorsed by it.

ReneSchumacher commented 2 years ago

Hi @cbrabin,

we're currently releasing v1.13.0 of the Create Work Item Task which now supports setting extension fields (i.e., Kanban Board Column, Kanban Board Swimlane, and Split Column Status (doing/done)). You can add those fields to fieldMappings with the following syntax: <Team name>:<Board name>:(Column|Lane|Column.Done). There's no need to figure our the reference name yourself.

Example:

- task: CreateWorkItem@1
  inputs:
    # all other parameter
    fieldMappings: |
      DevTeam1:Backlog Items:Column = Approved
      DevTeam1:Backlog Items:Lane = High Prio
      DevTeam2:Backlog Items:Column = Analysis
      DevTeam2:Backlog Items:Column.Done = true

Please remember that the task can only set the column if it's mapped to the initial work item state. This is due to the limitation that work items can only be created in their initial state. Let me know if this works for you.

cbrabin commented 2 years ago

Hi

Thank you for you time and effort on this, it is very much apricated. I will give it a try out as soon as I can.

Christopher Brabin Manager | Technology & Digital Services | Deloitte LLP D: +44 20 7303 7118 | M: +44 7785 292661 @.**@.> | www.deloitte.co.uk

From: René Schumacher @.> Sent: 18 August 2021 10:29 To: MicrosoftPremier/VstsExtensions @.> Cc: Brabin, Chris @.>; Mention @.> Subject: [EXT] Re: [MicrosoftPremier/VstsExtensions] Issue with Swimlane/Kanban attribute (#148)

Hi @cbrabinhttps://secure-web.cisco.com/1gl2qImGb4pkRdLPFLkZcHGrAEJ3BSltIHpX_TTfXcZmBcdMVXgA9nwzh3aKQeOur_HqV_6d3KDaLYROkp9Ljm0DMtXec6t_670qovEgG80qAtVrg1F8mjcqsVikClHZ_JDXgf6U_AgMie6b7gFzZBdbLK3gIh5Nmq46G4J195Sg2sw_h31ynykDl9VXIGSdA-s8b30TvbQH9RLdIMiDkSC1XQCTLqYPO7rxxa2tUUVAmp_RenP5KJyGwF7dSdUIiZvnzRJZOltyGtfkA3NXiHT1FChap9dIsgv1ZAn3Fani7RRl7NGVgRegykEQNtjrz/https%3A%2F%2Fgithub.com%2Fcbrabin,

we're currently releasing v1.13.0 of the Create Work Item Task which now supports setting extension fields (i.e., Kanban Board Column, Kanban Board Swimlane, and Split Column Status (doing/done)). You can add those fields to fieldMappings with the following syntax: ::(Column|Lane|Column.Done). There's no need to figure our the reference name yourself.

Example:

Please remember that the task can only set the column if it's mapped to the initial work item state. This is due to the limitation that work items can only be created in their initial state. Let me know if this works for you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1Nxx-M9xEssATOuUKvVFEA0o0PscbVxJWWgnXVT7G2ceHZrLLBiob0GecI_jmSwUYLVC9GFT7XIFKvmGc7YBdPVrUM0H2Fi9HENXfjpOwqOHY7bx0PkA__FwN-dQsz19VEve6D7y6xLthFvyqqVSnq0jxo-oMLa8JjaP0lMrHICKg5Diab597_FJkyBwmoGsKhD-ccIsfSLEQsdRlQIvBGMtw-31CMq29JcOSJr-KEF0oRButd3ZkLYzRYhA4Onkn93f2GyDcK4bFsxdaAlRrUYBDDTuHTVk7vKAe6kN5QS_vp9ZgU6-qpi_9D9GmirKM/https%3A%2F%2Fgithub.com%2FMicrosoftPremier%2FVstsExtensions%2Fissues%2F148%23issuecomment-900964570, or unsubscribehttps://secure-web.cisco.com/1ntKmQGU5hT0DAWEmeToKewrgzHU8letsclK2aN2J5d2J0qLYGDGla0n_LXR78yndco4ZXZ3wB0ewy8EHxb-snWH7ciN0gAjBgHSh3Ta0Me8RrneeoyKbv32fN8_8OF-BRiSYCuthxw8yV4-7Z8xW9FdkRaUWWSp2Im_1RR8RVN6_hS6kND2bNi7sEvL3deakxn2XZzfMlJlf8zeyITcrvIlv5jeA01pZXGEhie9PHDZWezekmh_w1IOVNUHYyuMFfgB1IxYthWE2GZ5uGd1dN-6TWGF6EoKp__aAQsf-ctEBuO5TeT1becSXzdZXfcUC/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAU2FKQ566DDHNATUGZTTACLT5N4PNANCNFSM5AGZZ3AQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email. IMPORTANT NOTICE

This communication is from Deloitte LLP, a limited liability partnership registered in England and Wales with registered number OC303675. Its registered office is 1 New Street Square, London EC4A 3HQ, United Kingdom. Deloitte LLP is the United Kingdom affiliate of Deloitte NSE LLP, a member firm of Deloitte Touche Tohmatsu Limited, a UK private company limited by guarantee (“DTTL”). DTTL and each of its member firms are legally separate and independent entities. DTTL and Deloitte NSE LLP do not provide services to clients. Please see www.deloitte.co.uk/abouthttps://www.deloitte.co.uk/about to learn more about our global network of member firms. For details of our professional regulation please see Regulatorshttps://www2.deloitte.com/uk/en/footerlinks1/regulators-and-provision-service-regulations.html.

This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please notify @.**@.> and destroy this message immediately. Email communications cannot be guaranteed to be secure or free from error or viruses. All emails sent to or from a @deloitte.co.uk email account are securely archived and stored by an external supplier within the European Union.

You can understand more about how we collect and use (process) your personal information in our Privacy Noticehttps://www2.deloitte.com/uk/en/legal/privacy.html.

Deloitte LLP does not accept any liability for use of or reliance on the contents of this email by any person save by the intended recipient(s) to the extent agreed in a Deloitte LLP engagement contract.

Opinions, conclusions and other information in this email which have not been delivered by way of the business of Deloitte LLP are neither given nor endorsed by it.

ReneSchumacher commented 2 years ago

Hi again,

since I haven't heard any negative feedback, I'm closing the issue for now. If you still have issues with setting extension fields, feel free to add additional comments and I will reopen.

MichaelReitsma commented 2 years ago

I have some trouble finding out the Board Name and Team name from the Boards GUI of Azure. Where can i find the exact Project and Board Name in the Azure Gui to use here?

Another q came up after reading your earlier comments on the use of this. If your Board does not use/have a column that shows/allows 'New' tasks then the new task will not show up even if all is set correctly. Is that correct ? We are using this to create a Task for every succesfull production deployment there is. It will be linked to a userStory which acts as a parent . Can a task which has a parent(userstory) show up in a different column/lane than its parent ?

ReneSchumacher commented 2 years ago

Hi @MichaelReitsma,

you can get the team and board name from the board UI in Azure DevOps: image

The team is shown above the board on the left in a drop-down box with which you can also change the team. The board name is shown above the board on the right in a drop-down box with which you can also change the board (given that you have enabled multiple portfolio levels).

In my earlier comments in this thread I just explained that work items can only be created in their initial state (the very first state in the work item type's state list). This is a limitation of the work item tracking system in Azure DevOps and can only be overridden with special administrative permissions usually not available to the pipeline identity. Thus, the newly created work item will always be in its initial state. Since board columns are directly mapped to work item states, you can only set the board column to a value that maps to the work item's initial state. Otherwise, the board column is simply ignored.

Here's an example to make it clearer: let's assume your work item has the states New (initial state), In Progress, and Done and you have a board with the following columns and mapped work item states: Backlog (mapped to New), Approved (mapped to New), Refinement (mapped to New), In Development (mapped to In Progress), In Test (mapped to In Progress), and Live (mapped to Done). With this setup, you have three board columns that map to the work item's initial state and, thus, you can set the board column to Backlog, Approved, or Refinement. However, you could not set the board column to In Development because that column maps to the In Progress state which is not the initial state.

The answer to your third question is yes and now. While parents and children can be in different columns on different boards, the board column only works for Kanban boards. These are boards like Features, Epics, User Stories, or Backlog Items. Tasks are part of the sprint board and are not tracked on the Kanban boards.

MichaelReitsma commented 2 years ago

Thnx for the clarification.