Contacts_Add Operation

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

Creates a new contact in QAComplete.

Use the ProjId value in the AuthenticationData parameter to specify a project to create a contact in.

Requirements

The authenticating user must belong to a user group that has the Add privilege for Contacts.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object containing the login information and the project ID to create the contact in.

Contact  :  Contact, required

A Contact object containing the contact information.

SendEmailAlert  :  string, required

Y means send an email alert to the subscribed users after adding the contact.

Any other value (for example, N or empty string) means do not send email alerts.

NewNotes  :  string

A note to add to the contact. Default value: empty string.

Result

An integer ID of the created contact.

Remarks

The Contact object you pass must have all the property values required by your QAComplete instance. You can see the required properties in two places:

  • Required fields for contacts:  > Setup > System Configuration > Screen Layouts > Contact Manager > Required Fields.

  • Contact workflow transitions: Contacts > Show Contacts > Actions > Manage Workflows > select status > Select fields for this Transition.

Do not specify the following properties; they are set automatically:

  • DateCreated and DateUpdated are set to the current date and time.

  • UpdateUserId and UserName are set to the authenticating user.

The Contact object has matching Id and Name properties, for example, AssigneeUserId and AssignedToName. To set them, specify the value only for the Id property. The corresponding Name property will be set automatically.

Example

Sample Code

C#

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

// Contact details
string contactPerson = "John Smith";
string companyName = "Smith & Doe Inc.";
string email = "[email protected]";
string title = "Developer";
string status = "Active";
string contactType = "Vendor";
DateTime date1stContact = new DateTime(2012, 02, 20);

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;

// Preparing the contact
Contact contact = new Contact();
contact.ContactPerson = contactPerson;
contact.CompanyName = companyName;
contact.Email = email;
contact.Title = title;
contact.Status = status;
contact.ContactType = contactType;
contact.Date1stContact = date1stContact;

// Adding the contact
int contactId = service.Contacts_Add(authData, contact, "N", "");
Console.WriteLine("Contact ID:" + contactId);

Java

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

// Contact details
String contactPerson = "John Smith";
String companyName = "Smith & Doe Inc.";
String email = "[email protected]";
String title = "Developer";
String status = "Active";
String contactType = "Vendor";

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);

// Preparing the contact
Contact contact = new Contact();
contact.setContactPerson(contactPerson);
contact.setCompanyName(companyName);
contact.setEmail(email);
contact.setTitle(title);
contact.setStatus(status);
contact.setContactType(contactType);

// Specifying the first contact date
XMLGregorianCalendar date1stContact;
try {
    date1stContact = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar(2012, 02, 20));
    contact.setDate1StContact(date1stContact);
}
catch (Exception e) {
    e.printStackTrace();
}

// Specifying the contact
int contactId = service.contactsAdd(authData, contact, "N", "");
System.out.println("Contact ID:" + contactId);

Sample Request XML

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

<?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>
    <Contacts_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Contact>
        <ContactPerson>John Smith</ContactPerson>
        <CompanyName>Smith & Doe Inc.</CompanyName>
        <Email>[email protected]</Email>
        <Title>Developer</Title>
        <Status>Active</Status>
        <ContactType>Vendor</ContactType>
        <Date1stContact>2012-02-20T00:00:00</Date1stContact>
      </Contact>
      <SendEmailAlert>N</SendEmailAlert>
      <NewNotes></NewNotes>
    </Contacts_Add>
  </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: 803 {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>
    <Contacts_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <Contact>
        <ContactPerson>John Smith</ContactPerson>
        <CompanyName>Smith & Doe Inc.</CompanyName>
        <Email>[email protected]</Email>
        <Title>Developer</Title>
        <Status>Active</Status>
        <ContactType>Vendor</ContactType>
        <Date1stContact>2012-02-20T00:00:00</Date1stContact>
      </Contact>
      <SendEmailAlert>N</SendEmailAlert>
      <NewNotes></NewNotes>
    </Contacts_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 369 {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>
    <Contacts_AddResponse xmlns="http://www.pragmaticsw.com/">
      <Contacts_AddResult>7</Contacts_AddResult>
    </Contacts_AddResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 379 {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>
    <Contacts_AddResponse xmlns="http://www.pragmaticsw.com/">
      <Contacts_AddResult>7</Contacts_AddResult>
    </Contacts_AddResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

Contacts_Delete
Contacts_Load
Contacts_LoadByCriteria
Contacts_Update
Contacts Operations
SOAP API Reference

Highlight search results