Hi Can anyone suggest me how to send a customer de...
# suitescript
a
Hi Can anyone suggest me how to send a customer details in responseobj in restlet2.0
b
do you care about how the response is formatted
if not, you can simply return a record loaded by the record module
a
No formated
Could please share a one example
Scenario is when I am putting a mobile no and I have to send customer name ,email, subsidiary,etc after extracting the data from netsuite in JSON format through restlet2.0
b
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType Restlet
 * @NModuleScope SameAccount
 */
define(["N/record", "N/search"], function(record, search) {
  return {
    get: function(requestParams) {
      var customerSearch = search.create({
        type: search.Type.CUSTOMER,
        filters: [["stage", "is", "CUSTOMER"]]
      });
      var customerResultSet = customerSearch.run();
      var customerResults = customerResultSet.getRange(0, 1);
      var customerRecord = record.load({
        type: record.Type.CUSTOMER,
        id: customerResults[0].id
      });

      return JSON.stringify(customerRecord);
    }
  };
});
I don't think missing format requirements upfront is good requirement gathering
there should be an agreed upon format upfront, the example I gave just returns all the data on the customer
and does a search for the first customer in your account
a
Thankyou