Thursday, April 18, 2019

Save Data Coming from a Suitelet to a Custom Form

Most of the time, Suitelets are being used to retrieve information. If the user would like to store the data coming from the Suitelet to a Custom Form, below is a sample:

function suiteletToCustomForm(request, response)
{
    
var form = nlapiCreateForm('Suitelet Form');

form.addField('text','text','Text');
form.addField('q1','select','Question 1:' ,'customlist276').setMandatory(true);
    
form.addSubmitButton('Submit');

response.writePage( form );

var rec = nlapiCreateRecord('customrecord_sample');
rec.setFieldValue('custrecord_sample_text', request.getParameter('text'));
rec.setFieldValue('custrecord_sample_q1', request.getParameter('q1'));

nlapiSubmitRecord(rec);

}



DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Netsuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.

Netsuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Netsuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.

Netsuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code

 

No comments:

Post a Comment