AddCustomerAddress.ss

function service(request,response) { /*var addressee = request.getParameter('addressee'); var addr1 = request.getParameter('addr1'); var city = request.getParameter('city'); var state = request.getParameter('state'); var zip = request.getParameter('zip'); var country = request.getParameter('country'); var phone = request.getParameter('phone'); var address = { addressee : addressee, addr1 : addr1, city : city, state : state, zip : zip, country : country, phone : phone, defaultshipping : 'T', defaultbilling : 'T' };*/ // Or the object string can be passed from the request header var address = JSON.parse(request.getHeader('customerAddress')); // Get a reference to the customer var customer = nlapiGetWebContainer().getShoppingSession().getCustomer(); try { // Add the address var status = customer.addAddress(address); var result = customer.getFieldValues(); // return the customer data through response response.writeLine(JSON.stringify(result.customer)); } catch (e) { var e2 = nlapiCreateError(e); // Do error handling here } }