Marty Zigman - The NetSuite Expert

Conversations with Marty Zigman

Certified Administrator • ERP • SuiteCloud

Prolecto Labs Accelerator Templates

How to Automatically Generate a NetSuite Customer Refund from a Credit Memo

Accounting NetSuite Technical



This article is relevant if you are looking for a way to generate a URL or script a NetSuite customer refund record from a NetSuite credit memo record.

Background

During a recent integration project with a client that had full customer service and payment processes controlled by their eCommerce site, we needed a completely automated credit and returns process in NetSuite that would properly record return authorizations, credit memos, and cash refunds.   In many of the processes we needed to automate, monies would be returned to the customer depending if the products arrived back to the warehouse.  The general pattern for processing a return authorization is as follows:

  1. Return Authorization: a planning record to indicate we are expecting goods back at the warehouse.
  2. Item Receipt: a financial record that indicates the goods have indeed arrived.
  3. Credit Memo: a financial record to debit sales and credit accounts receivable.
  4. Cash Refund: a financial record to debit accounts receivable and credit cash to return funds to the customer.

Since SuiteScript was used to hold the logic together, it was natural to look for efficiencies in the development process where we could.

Note on NetSuite Debit to Sales on Returns

As a side note, many NetSuite folks with an accounting background are not satisfied that a return produces a debit to the same income account as the original sale.  They instead would like to see a debit to a different general ledger account (typically Sales Returns).  I share a solution for the challenge in my article, Automate Allowance Programs using NetSuite SuiteGL.

Pattern to Automatically Apply a Credit Memo During the Cash Refund Generation

If you observe the way NetSuite works, it passes URL parameters to its customer refund record processor as follows:

https://4541212-sb1.app.netsuite.com/app/accounting/transactions/custrfnd.nl?entity=520&cred=51061288

There are two parameters we are interested in (bolded above and below):

  1. entity: this is the internalid of customer record
  2. cred: this is the internalid of credit memo.

When you see NetSuite passes extra values to its built-in programs, you have an opportunity to generate URLs from saved searches to help your users drive NetSuite.  These often will clue you into undocumented features of the platform that can be driven from SuiteScript.

SuiteScript 2.0 for Auto Selecting the Credit Memo during Cash Refund Generation

Once you see these parameters on your URLs, you can then speculate further that you can drive NetSuite to behave a certain way in your server-side scripting.   Working with Jaime R., a technical consultant on our team, he produced the following code pattern that illustrates you can pass in the parameters.  The great news is NetSuite then prepares the Customer Refund record with the specific customer and credit memo that is being refunded and the work to look up those values is done for you.

var customerRefundRecord = record.create({
	type: record.Type.CUSTOMER_REFUND,
	isDynamic: true,
	defaultValues: {
		entity: creditMemoData.entity,
		cred: creditMemoData.recordId
	}
});

Under this approach, the credit memo will automatically be selected to be applied when the customer refund record is created thus saving you from having to write the logic to loop through the list to find the applicable credit memo to apply.

Collaborate with NetSuite Experts

The article above should be helpful to individuals who understand how to program in SuiteScript and the NetSuite administrator who wishes to drive URL generation.  If you found this article helpful, feel free to receive notifications of new posts.  If you would like to automate your NetSuite experience, let’s have a conversation.

 

 

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

2 thoughts on “How to Automatically Generate a NetSuite Customer Refund from a Credit Memo

  1. Fred says:

    Would you happen to know what to put on the default values if it was a deposit that needs to be defaulted

  2. Marty Zigman says:

    Hello Fred,

    Of hand, I do not know the values. But this article should provide you guidance to discover:
    https://blog.prolecto.com/2018/05/20/drive-values-to-netsuite-forms-and-other-url-tricks/

    Marty

Leave a Reply

Your email address will not be published. Required fields are marked *