
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
I have an attribute of type "list" (single not multi select) with about a few hundred items. These items were imported from a different tool and unfortunately not sorted before the import. Now I want to sort the values alphabetically without affecting the test cases that already have this attribute attached. The items do not have a numeric weight.
As rearranging such a long list is more than painful with the GUI, I try to do this via API.
In general the tmplanning service seems to offer this functionality: like updateNote (which worked for me in other scripts) there is also an updateAttribute function. Unfortunately this function does not report an error but also does not change anything. I tried to rearrange existing attribute items, rename existing attribute items or even add new items (which is normally done with a different API function) with it, but nothing happened.
I use the powershell to call the functions and it is basically this sequence:
$attrList = $tmPlanningService.getAttributes($sessionId, $projectId)
$cat = $attrList |Where-Object { $_.name -eq "myattribute" }
$temp = $cat.options |Sort-Object name
$cat.options = $temp
$myattr = @($cat)
$tmPlanningService.updateAttributes($sessionId, $projectId, $myattr)
The last function call returns the "updated" attribute just like the function description says, containing my modified values, but the GUI still contains the old ones.
I tried also the function "getAttributesWithOptionValues" but it seems to be buggy, as it only works for projectId = 0 (which is the Demo Project on my server):
[DBG]: PS D:\>>> $tmPlanningService.getAttributesWithOptionValues($sessionId, 0)
active : True
description :
id : 62
name : Importance
optionsWithValues : {Critical, High, Medium, Low}
type : normal
[DBG]: PS D:\>>> $tmPlanningService.getAttributesWithOptionValues($sessionId, $projectId)
Ausnahme beim Aufrufen von "getAttributesWithOptionValues" mit 2 Argument(en): "java.rmi.RemoteException: null; nested exception is:
java.lang.NullPointerException"
Bei Zeile:1 Zeichen:49
+ $tmPlanningService.getAttributesWithOptionValues <<<< ($sessionId, $projectId)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Anyone has an idea what I do wrong or if there is another way to achieve this?
I'm using SCTM 15.5.
thanks for any help,
Wolfgang
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Wolfgang,
Updating attribute options via web service interface is not supported. This would be an enhancement.
Regards,
Hubert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Wolfgang,
Updating attribute options via web service interface is not supported. This would be an enhancement.
Regards,
Hubert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Thanks for the answer.
Then I guess I have to write a script to create a second attribute, fill it with the sorted values from the first attribute, attach the new attribute to all testcases that use the first attribute and rename the attributes.
Cheers,
Wolfgang