Reputation: 129
Suitelet defalt form is ugly. I want to create a custom form using bootstrap for suitelet in Netsuite. Can I do that? I want to display this bootstrap form using html with suitelet.
e.g for a bootstrap form
<form role="form">
<div class="form-group">
<label for="name">Name</label>
<input type="name" class="form-control" id="name" name="name">
</div>
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" class="form-control" id="email" name="email">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
Can I fetch the get value of the form using suitlet default get API
var email= request.getParameter('email');
var name = request.getParameter('name');
var newCust = nlapiCreateRecord('customer');
newCust.setFieldValue('xxxx', name);
newCust.setFieldValue('xxxx', email);
var id = nlapiSubmitRecord(newCust);
Upvotes: 2
Views: 4754
Reputation: 3029
Check this out, I created this Suitelet in Suitescript 2.0. Its a hack but works fine. Just add your POST conditionals to grab the data from the form. https://ursuscode.com/netsuite-tips/loading-custom-html-and-bootstrap-within-a-suitelet-form/
Upvotes: 4
Reputation: 2288
You can use regular form post with action
method pointing to your suitescript end point and on the other side you can get the values with request.getAllParameters()
.
e.g
HTML:
<form role="form" action = "https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=1&compid=XXXXXX&h=XXXXXXXXXXXXX" method ="POST">
Suitescript:
var params = request.getAllParameters();
var email= params['email'];
var name = params['name'];
Upvotes: 1
Reputation: 7343
If you are using your own HTML/CSS, you should be able to get the values using request.getBody()
. You should then parse the response body to fetch the values from form.
Alternatively, you can write a client-side javascript, which sets the URL parameters and its values on submit
event, then you would be able to get the values using request.getParameter()
APIs.
Upvotes: 0