Example of Adding a Campaign Response Record

The following example shows how to add a campaign response record. In this example, the campaignResponseDate is manually set.

C#

          private void addCampaignResponse()
{

   CampaignResponse newCampaignResponse = new CampaignResponse();


   // Identify a campaign listed at Lists >
   // Marketing > Marketing Campaigns.

   RecordRef recordLeadSource = new RecordRef();
   recordLeadSource.type = RecordType.campaignResponse;
   recordLeadSource.internalId = "-5";
   newCampaignResponse.leadSource = recordLeadSource;


   // Identify an existing NetSuite entity record,
   // in this case a customer.

   RecordRef recordCustomer = new RecordRef();
   recordCustomer.type = RecordType.customer;
   recordCustomer.internalId = "1766";
   newCampaignResponse.entity = recordCustomer;


   // Identify the date and time that the customer responded,
   // using the campaignResponseDate field. 

   DateTime lastWeek = new DateTime(2013, 9, 27, 8, 45, 00);
   newCampaignResponse.campaignResponseDate = lastWeek;
   newCampaignResponse.campaignResponseDateSpecified = true;


   // Optionally, specify a note and an external ID.

   newCampaignResponse.note = "note text";
   newCampaignResponse.externalId = "123456";


   // Execute operation.

   _service.add(newCampaignResponse);

} 

        

SOAP Request

          <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Header> ...
    </soap:Header>
    <soap:Body>
        <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
            <record externalId="123456" xsi:type="q1:CampaignResponse" xmlns:q1="urn:marketing_2017_1.lists.webservices.netsuite.com">
                <q1:entity internalId="1766"/>
                <q1:leadSource internalId="-5"/>
                <q1:campaignResponseDate>2013-09-27T08:45:00</q1:campaignResponseDate>
                <q1:note>note text</q1:note>
            </record>
        </add>
    </soap:Body>
</soap:Envelope> 

        

SOAP Response

          <soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header> ...
    </soapenv:Header>
    <soapenv:Body>
        <addResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
            <writeResponse>
                <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
                <baseRef xsi:type="platformCore:RecordRef" type="campaignResponse" externalId="123456" internalId="303" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
            </writeResponse>
        </addResponse>
    </soapenv:Body>
</soapenv:Envelope> 

        

UI Result

The following screenshot shows the result of the SOAP request. The date in the red box is the date the SOAP request was sent. The date in the blue box is the date specified in the SOAP request.

Campaign response details in the UI.

Related Topics

Campaign Response
Campaign Response Supported Operations
Working with the campaignResponseDate Field
Campaign Response Usage Notes
Example of Getting a Campaign Response Record
Marketing Records
How to Use the SOAP Web Services Records Help
SOAP Web Services Supported Records
SOAP Schema Browser
SuiteTalk SOAP Web Services Platform Overview

General Notices