Adding an Item Account Mapping Record

The following example shows how to create an item account mapping record. In this example, the Custom Dimension field has been configured to reference billing schedule. The request also specifies the use of a custom entry form.

C#

          private void addItemAccountMapping()
{

    // create object

      ItemAccountMapping newItemAccountMapping = new ItemAccountMapping();


      // specify the custom entry form that should be used

      RecordRef myCustomForm = new RecordRef();
      myCustomForm.type = RecordType.customRecord;
      myCustomForm.typeSpecified = true;
      myCustomForm.internalId = "102";
      newItemAccountMapping.customForm = myCustomForm;


      // create external Id

      newItemAccountMapping.externalId = "106D";


      // set effective date

      DateTime lastWeek = new DateTime(2013, 1, 28);
      newItemAccountMapping.effectiveDate = lastWeek;
      newItemAccountMapping.effectiveDateSpecified = true;


      // set end date

      DateTime nextYear = new DateTime(2014, 1, 28);
      newItemAccountMapping.endDate = nextYear;
      newItemAccountMapping.endDateSpecified = true;


      // set accounting book

      RecordRef accountingBook = new RecordRef();
      accountingBook.internalId = "2";
      newItemAccountMapping.accountingBook = accountingBook;


      // set subsidiary

      RecordRef subsidiaryRef = new RecordRef();
      subsidiaryRef.internalId = "2";
      newItemAccountMapping.subsidiary = subsidiaryRef;


      // set item account type; this choice determines
      // the exact accounts available when you select
      // source account and destination account.

      newItemAccountMapping.itemAccount = ItemAccountMappingItemAccount._asset;
      newItemAccountMapping.itemAccountSpecified = true;


      // set source account

      RecordRef mySourceAccount = new RecordRef();
      mySourceAccount.type = RecordType.account;
      mySourceAccount.typeSpecified = true;
      mySourceAccount.internalId = "9";
      newItemAccountMapping.sourceAccount = mySourceAccount;
          

      // set destination account

      RecordRef myDestinationAccount = new RecordRef();
      myDestinationAccount.type = RecordType.account;
      myDestinationAccount.typeSpecified = true;
      myDestinationAccount.internalId = "11";        
      newItemAccountMapping.destinationAccount = myDestinationAccount;
          

      // set custom dimension - in this case, the custom dimension field
      // has been configured to reference billing schedule.

      RecordRef myBillingSchedule = new RecordRef();
      myBillingSchedule.type = RecordType.billingSchedule;
      myBillingSchedule.typeSpecified = true;
      myBillingSchedule.internalId = "6";
      newItemAccountMapping.customDimension = myBillingSchedule;


      // execute add operation

      _service.add(newItemAccountMapping);

} 

        

SOAP Request

          <soap:Body>
   <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <record externalId="106D" xsi:type="q1:ItemAccountMapping" xmlns:q1="urn:accounting_2017_1.lists.webservices.netsuite.com">
         <q1:customForm type="customRecordType" internalId="102"/>
         <q1:effectiveDate>2013-01-28T00:00:00</q1:effectiveDate>
         <q1:endDate>2014-01-28T00:00:00</q1:endDate>
         <q1:accountingBook internalId="2"/>
         <q1:subsidiary internalId="2"/>
         <q1:itemAccount>_asset</q1:itemAccount>
         <q1:sourceAccount type="account" internalId="9"/>
         <q1:destinationAccount type="account" internalId="11"/>
         <q1:customDimension type="billingSchedule" internalId="6" xsi:type="q2:RecordRef" xmlns:q2="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </record>
   </add>
</soap:Body> 

        

SOAP Response

          <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="itemAccountMapping" externalId="106D" internalId="404" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </addResponse>
</soapenv:Body> 

        

Related Topics

Item Account Mapping
Updating an Item Account Mapping Record
Item Account Mapping Supported Operations
Item Account Mapping Field Definitions
Common Errors With Item Account Mappings
Multi-Book Accounting Overview
Chart of Accounts Mapping
Item Account Mapping
Mapping Restrictions
How to Use the SOAP Web Services Records Help
SOAP Web Services Operations
add

General Notices