Updating the Deposit Record

The following example shows how to update the deposit record by removing a line from the Payments sublist and adding a different line. Also in this example, the Cash Back sublist is overwritten with new entries. The Cash Back sublist is not keyed, so overwriting it is the only way to update it.

Because the Payments sublist is basically a list of other records, the only change you can make to an existing line is to remove it from the sublist.

C#

          private void updateDeposit()
{

   // Create object.

   Deposit myUpdatedDeposit = new Deposit();


   // Identify the record to update.

   myUpdatedDeposit.externalId = "804A";


   // Create an instance of the Payment sublist. Set ReplaceAll
   // to false, since you want to selectively update the list.

   myUpdatedDeposit.paymentList = new DepositPaymentList();
   myUpdatedDeposit.paymentList.depositPayment = new DepositPayment[2];
   myUpdatedDeposit.paymentList.replaceAll = false;


   // Identify the changes you want to make. To remove an existing line
   // from the sublist, set the deposit field to false. To add a new line,
   // set the field to true. The id field identifies the internal ID of the
   // transaction record being deposited


   myUpdatedDeposit.paymentList.depositPayment[0] = new DepositPayment();
   myUpdatedDeposit.paymentList.depositPayment[0].id = 1969;
   myUpdatedDeposit.paymentList.depositPayment[0].idSpecified = true;
   myUpdatedDeposit.paymentList.depositPayment[0].deposit = false;
   myUpdatedDeposit.paymentList.depositPayment[0].depositSpecified = true;

   myUpdatedDeposit.paymentList.depositPayment[1] = new DepositPayment();
   myUpdatedDeposit.paymentList.depositPayment[1].id = 1742;
   myUpdatedDeposit.paymentList.depositPayment[1].idSpecified = true;
   myUpdatedDeposit.paymentList.depositPayment[1].deposit = true;
   myUpdatedDeposit.paymentList.depositPayment[1].depositSpecified = true;


   // Create an instance of the Cash Back sublist.

   myUpdatedDeposit.cashBackList = new DepositCashBackList();
   myUpdatedDeposit.cashBackList.depositCashBack = new DepositCashBack[1];


   // Populate the sublist.

   RecordRef myCashBackAccount = new RecordRef();
   myCashBackAccount.internalId = "38";

   myUpdatedDeposit.cashBackList.depositCashBack[0] = new DepositCashBack();
   myUpdatedDeposit.cashBackList.depositCashBack[0].amount = 1500;
   myUpdatedDeposit.cashBackList.depositCashBack[0].amountSpecified = true;
   myUpdatedDeposit.cashBackList.depositCashBack[0].account = myCashBackAccount;


   // Execute the operation.

   _service.update(myUpdatedDeposit);

} 

        

SOAP Request

          <soap:Body>
   <update xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <record xmlns:q1="urn:bank_2017_1.transactions.webservices.netsuite.com" xsi:type="q1:Deposit" externalId="804A">
         <q1:paymentList replaceAll="false">
            <q1:depositPayment>
               <q1:deposit>false</q1:deposit>
               <q1:id>1969</q1:id>
            </q1:depositPayment>
            <q1:depositPayment>
               <q1:deposit>true</q1:deposit>
               <q1:id>1742</q1:id>
            </q1:depositPayment>
            </q1:paymentList>
            <q1:cashBackList>
               <q1:depositCashBack>
                  <q1:amount>1500</q1:amount>
                  <q1:account internalId="38" />
               </q1:depositCashBack>
            </q1:cashBackList>
         </record>
   </update>
</soap:Body> 

        

SOAP Response

          <soapenv:Body>
   <updateResponse 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 internalId="7851" externalId="804A" type="deposit" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </updateResponse>
</soapenv:Body> 

        

Related Topics

General Notices