Editing items

The following example describes how to use the Helix ALM SDK to edit issues and change field values, such as the description, product, type, and summary. You can perform similar steps to edit other item types, such as test cases, manual test runs, requirements, and requirement documents.

Note:  Manual test runs saved in detail grid view cannot be edited using the SDK.

1. Localize external namespaces.

using System;

using System.Collections.Generic;

using System.Text;

2. Set up the namespace, provide the login information, and define the project name.

namespace UpdateDefect

{

class UpdateDefect

{

static void Main (string[] args)

{

long cookie = -1;

ttsoapcgi ttsdk = null;

 

try

{

string username = "username";

string password = "password";

string ProjectName = "ProjectName";

3. Create an instance of the ttsoapcgi class, which is generated from the ttsoapcgi.wsdl file.

ttsdk = new ttsoapcgi();

4. Set the URL that the ttsdk object connects to if you are not using the default URL from the WSDL file.

ttsdk.Url = "http://localhost:80/scripts/ttsoapcgi.exe";

5. Select the Helix ALM project to connect to and set proj to reference it.

CProject[] projects = ttsdk.getProjectList(username, password);

CProject proj = null;

 

foreach (CProject p in projects)

{

if (p.database.name.Equals(projectName))

{

proj = p;

break;

}

}

6. Log in to the project.

cookie = ttsdk.ProjectLogon(proj, username, password);

7. Use ttsoapcgi.editDefect() or ttsoapcgi.editDefectByRecordId() to retrieve and lock the record.

This prevents other clients or SOAP applications from editing the record. To search for an issue by summary, set the issue number to 0 and the summary to a non-empty string.

CDefect def = ttsdk.editDefect(cookie, 0, "Example Defect 1, With Formatted Text.", false);

def.summary = def.summary + " (edited)";

def.type = "Crash - No Data Loss";

8. Save the changes.

ttsdk.saveDefect(cookie, def);

9. Finish editing the issue and catch exceptions.

Console.WriteLine ("Finished editing defect");

}

 

catch (Exception e)

{

Console.WriteLine("An exception occurred:");

Console.WriteLine(e.Message);

}

10. End the session and log out of the Helix ALM SDK.

finally

{

if (ttsdk != null && cookie != -1)

{

ttsdk.DatabaseLogoff(cookie);

}

Console.WriteLine("Press any key to exit.");

Console.ReadKey();

}