Search code examples
c#sdkversionone

VersionOne SDK: How to Associate Defect with Epic?


I’ve written some C# code to create a VersionOne defect. That code works correctly. I now have to associate the newly created defect with an Epic (Portfolio item). For a test, I manually associated a defect with an Epic through the V1 GUI. When I use the rest API to display the defect, I see:

<Relation name="Super">
<Asset href="/VersionOne/rest-1.v1/Data/Epic/493072" idref="Epic:493072"/>
</Relation>

I assumed that making the relationship with other defects to other Epics was a matter of setting the “Super” attribute with the appropriate Epic value. So, in my code I tried:

IAttributeDefinition superAttribute = storyType.GetAttributeDefinition("Super");
newDefect.SetAttributeValue(superAttribute, "Epic:493074");

Unfortunately, this throws the following exception when I run the code:

ERROR: Connection exception!

*** VersionOne.SDK.APIClient

*** Error writing to output stream VersionOne.SDK.APIClient.APIException: Violation'Invalid'Defect.Super

Does anyone know how to associate a newly created defect with an Epic?


Solution

  • I did eventually resolve this. I first had to understand that V1 no longer uses Epics. It now calls them Portfolio Items. I then went through the process of manually associating a defect to a Portfolio Item to determine what fields within the GUI are used. Then, I spoke with my admin and learned that I was trying to access a part of the Portfolio Tree I was not authorized to. Once he granted me access, the above code in my post worked.