Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
Assigning nlobjRequest parameters to nlobjRecord (world's smalled class!)
If you are like me and use associative array/enum for your field names (you should, it's the gift that keeps giving!) then you might find this little nugget useful. It's also the world's smallest class (unconfirmed).
// usage var assessment = nlapiLoadRecord(REC_IDS.PATIENT_ASSESSMENT, id); Guard.NotNull(assessment, 'Failed loading Patient Assessment record ' + id); var setter = new SetRecordFieldsFromParameters(assessment, request); setter.Set(PAT_ASSESS_FLD.START_TM); setter.Set(PAT_ASSESS_FLD.TRNG_LOC); setter.Set(PAT_ASSESS_FLD.LOC_OTHR); // [...] // setter class (so cute!) function SetRecordFieldsFromParameters(record, request) { this._record = record; this._request = request; } SetRecordFieldsFromParameters.prototype = { Set: function(fieldId) { this._record.setFieldValue(fieldId, this._request.getParameter(fieldId)); } } // field names var PAT_ASSESS_FLD = { START_TM : 'custrecord_pat_assess_start_time', TYPE : 'custrecord_pat_assess_type', PATIENT : 'custrecord_pat_assess_patient', ASSESS_BY : 'custrecord_pat_assess_assessed_by', Order : 'custrecord_pat_assess_order', TRNG_LOC : 'custrecord_pat_assess_training_location', LOC_OTHR : 'custrecord_pat_assess_train_loc_other', TRNG_BY : 'custrecord_pat_assess_train_conducted_by', TRNG_BY_OTHR : 'custrecord_pat_assess_train_conducted_ot', GROK_TRN : 'custrecord_pat_assess_understood_traing', COND_TREATED : 'custrecord_pat_assess_cond_undr_treatmnt', PROD_WRKNG : 'custrecord_pat_assess_treatmnt_effective', TRT_FREQ : 'custrecord_pat_assess_treatmnt_frequency', Steve Klett | Senior Developer
NetValue Technology
0