RE: How can I batch invoices into customer payments using the REST API?

Hi all,

Having trouble creating/transforming invoices into customer payments using the REST API. I have no issue transforming an invoice into a customer payment like so:

POST {{REST_SERVICES}}/record/v1/invoice/4960/!transform/customerpayment 

However I’d like to add multiple invoices to a customer payment in one API call, and I’m not sure how to do that. When I structure my request like this;

How can I batch invoices into customer payments using the REST API?

I get the following error:

{
“type”: “https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1”,
“title”: “Error while accessing 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.”,
“status”: 400,
“o:errorCode”: “USER_ERROR”
}
Ideally I would be able to transform multiple invoices into a customer payment…perhas by using the transformation of customer->customerpayment. But I’m not sure how to include multiple invoices that way.
Thanks!
Jonathan Rookie Asked on August 28, 2020 in SuiteTalk.
Add Comment
7 Answers

Hi Jonathan,

I’ve not tried through REST Web Services but here are some notes I made on using SuiteScript:

————————————————————————————————————————

[…] the sublist on an Invoice Group is not like that on a standard transaction. In fact, the relationship from Invoice to Invoice Group is stored on the Invoices themselves in these two fields:

  • For Invoice Grouping (forinvoicegrouping)
  • Grouped To (groupedto)
However, to further complicate matters, from what I have seen neither of these fields may be directly scripted.
[…] I can confirm that the following actions allowed me to associate a couple of existing Invoices with an Invoice Group:
action.execute({id: ‘markforgrouping’, recordType: ‘invoice’, params: {recordId: XXX}});
action.execute({id: ‘markforgrouping’, recordType: ‘invoice’, params: {recordId: YYY}});

action.execute({id: ‘groupinvoices’, recordType: ‘invoicegroup’, params: {recordId: N, invoicelist: ‘XXX,YYY’}});
There are also the options to remove from a group and unmark for grouping.

————————————————————————————————————————

Not sure whether those fields are available through REST. Also, contrary to what I believed to be the case, it looks like actions are supported and so it’s worth checking whether these actions are included:
https://netsuite.custhelp.com/app/answers/detail/a_id/87480

Thanks,

Chris

Intermediate Answered on September 1, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.