1

I am trying to pay a specific invoice using the customerpaymet endpoint, I made the JSON structure using the documentation from https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2021.1/index.html#/definitions/customerPayment-applyCollection

This is my JSON:

{
  "aracct": {
    "id": "259"
  },
  "autoApply": false,
  "apply": {
    "items": [
      {
        "amount": 12.06,
        "apply": true,
         "doc": {
              "id": 5517
            } 
      }
    ]
  },
  "tranDate": "2021-10-13 3:34:01 PM",
  "customForm": {
    "id": "70"
  },
  "customer": {
    "id": "3645"
  },
  "payment": 12.06,
  "subsidiary": {
    "id": "3"
  }
}

This is the error:

{
  "detail": "Error while accessing a resource. You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",
  "o:errorPath": "apply",
  "o:errorCode": "USER_ERROR"
}

I would appreciate any help!

RcDEV
  • 66
  • 8

3 Answers3

0

This is how i do it in PHP, you can look at it for ideas on what you can try changing.

        $request =  [
            'record_data' => [
                [
                'internalid' => $nsOrder['internalId'],
                'source_type' => 'invoice',
                'result_type' => 'customerpayment',
                'transform_values' => '',
                'literal_fields'=> [
                                    'undepfunds' => 'F',
                                    'account' => '123',
                                    'customer' => $nsOrder['entity']['internalId'],
                                    'paymentmethod' =>  '8',//cc
                                    'memo' => $message,
                                    ],
                'sublists'=> [
                                ['name'=>'apply',
                                 'update' => [
                                                [
                                                'match'=> 'internalid',
                                                'data'=>[           
                                                            'internalid'=>$nsOrder['internalId'],
                                                            'apply'=>'T',
                                                            'amount' => $nsOrder['amountRemaining']
                                                        ]
                                                ]
                                             ]
                                ]
                             ]
                    ]
                ]
        ];

                
        $result = $this->curl->transform($request);
Hayden Thring
  • 1,718
  • 17
  • 25
0

The answer is that you need to select a combination of Undep Funds | PaymentMethod and Account in order for this to succeed. The documentation for this exists here

Gregg
  • 1,477
  • 1
  • 16
  • 17
0

I have the same problem with you and after a few tries, there's a mistake in my account and customer internal id, try create it on your netsuite tstdrv account first and recreate in on your JSON structure.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 01 '23 at 05:55