CustomFields_AddLookUp Operation

Applies to QAComplete 12.84 SaaS, last modified on July 19, 2021

Add a combo box field with a custom list of values to the specified QAComplete project and area (Defects, Requirements, and so on). In QAComplete, there are two types of these fields:

  • Choice List (List of Values)
  • Choice List (Multiselect)

The operation also creates a choice list (a LookUp object) with a list of the field’s possible values.

To add custom fields of other types, use the CustomFields_Add operation.

Requirements

The web service user must belong to a user group that has the Manage custom fields privilege.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object with the login information and the ID of the project to add the field to.

CustomField  :  CustomField, required

A CustomField object with the field information. All object properties except for IsRequired are required. Use the EntityCode property to specify the area (defects, requirements, and so on) to add this custom field to.

LookUpValues  :  string, required

A list of values for the combo box, separated by new line characters (
 in raw SOAP requests).

Result

The internal ID of the added custom field.

Example

Sample Code

The example below adds a combo box field named Component to defects. The combo box contains the values TextBox, ListView, and ComboBox.

C#

string login = "john.doe@example.com";
string password = "p@ssword";

ServiceSoapClient service = new ServiceSoapClient();

// Prepare 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 = loginInfo.ProjId;

// Prepare the CustomField object
CustomField field = new CustomField();
field.EntityCode = "Bugs";
field.CustomFieldNbr = 1;
field.FieldName = "Component";
field.FieldSize = 100;
field.FieldType = "Look Up";

string lookUpValues = "TextBox\nListView\nComboBox";

// Add the custom field
int ID = service.CustomFields_AddLookUp(authData, field, lookUpValues);

Java

String login = "john.doe@example.com";
String password ="p@ssword";

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

// Prepare 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(loginInfo.getProjId());

// Prepare the CustomField object
CustomField field = new CustomField();
field.setEntityCode("Bugs");
field.setCustomFieldNbr(1);
field.setFieldName("Component");
field.setFieldSize(100);
field.setFieldType("Look Up");

String lookUpValues = "TextBox\nListView\nComboBox";

// Add the custom field
int ID = service.customFieldsAddLookUp(authData, field, lookUpValues);

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 729 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/CustomFields_AddLookUp"
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CustomFields_AddLookUp xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <CustomField>
        <EntityCode>Bugs</EntityCode>
        <CustomFieldNbr>1</CustomFieldNbr>
        <FieldName>Component</FieldName>
        <FieldType>Look Up</FieldType>
        <FieldSize>100</FieldSize>
      </CustomField>
      <LookUpValues>TextBox&#xA;ListView&#xA;ComboBox</LookUpValues>
    </CustomFields_AddLookUp>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 737 {Insert an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <CustomFields_AddLookUp xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <CustomField>
        <EntityCode>Bugs</EntityCode>
        <CustomFieldNbr>1</CustomFieldNbr>
        <FieldName>Component</FieldName>
        <FieldType>Look Up</FieldType>
        <FieldSize>100</FieldSize>
      </CustomField>
      <LookUpValues>TextBox&#xA;ListView&#xA;ComboBox</LookUpValues>
    </CustomFields_AddLookUp>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 409 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CustomFields_AddLookUpResponse xmlns="http://www.pragmaticsw.com/">
      <CustomFields_AddLookUpResult>1</CustomFields_AddLookUpResult>
    </CustomFields_AddLookUpResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 419 {The server returns an appropriate value here}
 

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <CustomFields_AddLookUpResponse xmlns="http://www.pragmaticsw.com/">
      <CustomFields_AddLookUpResult>1</CustomFields_AddLookUpResult>
    </CustomFields_AddLookUpResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

CustomFields_Add
CustomFields_Delete
CustomFields_Load
Custom Field Operations
SOAP API Reference

Highlight search results