NetSuite Delete Operation through MuleSoft — Part 5
In this blog we will see how to perform Delete Operation using the NetSuite Delete Connector in MuleSoft by deleting a Customer record as an example.
Business Use-Case:
Let’s assume that there is a record which needs to be deleted such as Customer, Item etc., at the source system (It can be a Database, Salesforce etc.,) which needs to be synchronized at Oracle NetSuite. MuleSoft NetSuite Delete connector provides the facility to delete a record in NetSuite.
Delete Operation:
The delete operation is used to delete an existing instance of a record in NetSuite. It is identical in terms of functionality to the deleteList operation but only allows one record to be deleted per request. Let’s demonstrate the Delete Operation with a simple POC.
In the delete-customer-flow as shown in the above screenshot, NetSuite Delete Connector deletes a customer record in the NetSuite system.
First, set up a HTTP Listener with a path and configure connection. and then add a NetSuite Delete connector into the flow. Select the Ref type of the record as RecordRef and provide payload in the Message.
Then add a Transform message before the Delete operation and metadata will be generated automatically as shown in the below screenshot.
Select the required fields from the metadata and fill in the values that need to be added, now xsi schema needs to be defined in the code to make the operation work. Here is the example mapping with sample values for deleting a Customer record as shown in the below screenshot
And at the end of the flow add a Transform message and convert the output to JSON. Once the flow is triggered, NetSuite Delete Connector will delete the Customer record in the NetSuite.
Sample Response:
Note: To delete a customer which is associated with the transactions i.e., if one or more invoices are created for the customer then NetSuite will not delete the customer record and will throw an error message as shown in the below screenshot.
Conclusion
In this blog, we have seen how to delete a record using the NetSuite Delete connector in MuleSoft.