0
votes

GET https://dev.azure.com/{organization}/_apis/work/processes/{processId}/workItemTypes/{witRefName}/layout?api-version=5.0-preview.1

where,

{processId} : typeId of Agile, retrieved from https://dev.azure.com/{organization}/_apis/work/processes?api-version=5.1-preview.2

{witRefName} : Microsoft.VSTS.WorkItemTypes.Bug

Response:

{
    "$id": "1",
    "innerException": null,
    "message": "VS403115:You cannot modify form layout information for work item types Microsoft.VSTS.WorkItemTypes.Bug in process adcc42ab-9882-485e-a3ed-7678f01f66bc as these work item types are locked.",
    "typeName": "Microsoft.TeamFoundation.WorkItemTracking.Server.FormLayout.FormLayoutInfoNotAvailableException, Microsoft.TeamFoundation.WorkItemTracking.Server",
    "typeKey": "FormLayoutInfoNotAvailableException",
    "errorCode": 0,
    "eventId": 3200 
}

Doc: https://docs.microsoft.com/en-us/rest/api/azure/devops/processes/layout/get?view=azure-devops-rest-5.0

Anyone suggest some way to retrieve the layout of the workitem.

Thanks in advance!

Screenshots:

enter image description here

enter image description here

[ I have replaced my orgname in the url with test in the screenshots ]

1

1 Answers

1
votes

Can't get Azure Devops Workitem layout

According to the error message, it seems you are not using the correct rest method:

You cannot modify form layout information for work item types Microsoft.VSTS.WorkItemTypes.Bug in process

It seems you are using post/update rest method instead of Get.

I could use the that REST API to get the Workitem layout.

First, use the REST API Processes - List to get the typeId:

GET https://dev.azure.com/{organization}/_apis/work/processes?api-version=5.1-preview.2

enter image description here

Then use the REST API Layout - Get to get the Workitem layout:

GET https://dev.azure.com/{organization}/_apis/work/processes/{processId}/workItemTypes/{witRefName}/layout?api-version=5.0-preview.1

enter image description here

Update:

But I still get the same error. I used the process list REST API u have given to get the process typeId and GET http call to retrieve the layout.

I could reproduce this issue for the default process. But this issue does not occur in our inherited process.

If I use the REST API Layout - Get for the default process, I will get the same error:

VS403115:You cannot modify form layout information for work item types Microsoft.VSTS.WorkItemTypes.Bug in process

Obviously this is not a reasonable return result, since we are using the Get method, it does not modify form layout information.

So, this is an issue for this REST API to get the Workitem layout info.

I submit this issue to the product team:

https://developercommunity.visualstudio.com/content/problem/1127650/the-rest-api-layout-get-does-not-return-the-correc.html

You could check that ticket for the feedback or you could add your comment for this issue.