Redirecting to a Record from Suitelet on a button Click

To return the new purchase order internal id from your suitelet you will need to write it on the response :

response.write(purchaseOrderId);

You can catch that value from your client side script :

  var response = nlapiRequestURL(url);  // run response validation if (response.getCode() == 200) {  var purchaseOrderId = response.getBody();  }  

Then you can redirect to your purchase order page :

 var purchaseOrderUrl = nlapiResolveURL('RECORD', 'purchaseorder', purchaseOrderId);  window.location = purchaseOrderUrl; 

Leave a comment

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