Change Defect Status

Applies to QAComplete 14.3, last modified on February 19, 2024

The code below shows how to update the status of a defect in your project in QAComplete. The code uses the Bugs_Update operation that gets a defect by its ID and updates its properties with new values you specify. All unspecified properties are cleared.

You can change the status (or any other property) of items of other types (releases, tasks, requirements, and so on) the same way you change the defect’s status. To do this, use the appropriate operation (Releases_Update to update the release’s status, ProjectTasks_Update to update the task’s status and so on). For information on available operations you can use to update item properties, see API Reference.

C#

string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;

// Specifying the bug to update
int ID = 43;

ServiceSoapClient service = new ServiceSoapClient();

// Preparing AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = projID;

// Loading existing defect data
Bug bug = service.Bugs_Load(authData, ID);

// Specifying new defect status
bug.StatusCode = "Closed";

// Updating the defect
service.Bugs_Update(authData, bug, "N");
Console.WriteLine("The defect status was updated.");

Java

String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;

// Specifying the bug to update
int ID = 43;

ServiceSoap service = new Service().getServiceSoap12();

// Preparing AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projID);

// Loading existing defect data
Bug bug = service.bugsLoad(authData, ID);

// Specifying new defect status
bug.setStatusCode("Closed");

// Updating the defect
service.bugsUpdate(authData, bug, "N");
System.out.println("The defect status was updated.");

To learn more about the Bugs_Update operation syntax, parameters and view its sample request and response, see the method description.

To view an example that demonstrates how to update several item’s properties, see Change Item Properties.

See Also

Bugs_Update Operation
Change Item Properties
How To Update Items
How To

Highlight search results