Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How can I eliminate having to not repeat the same code

I have a script that adds items to a Netsuite record. In this case 22 items needs to be added but the value lines in the below are different for each item. Rather than having to repeat the same lines over and over again is there a better way to do this.

Code below:

             rec.setCurrentSublistValue(
             {
                sublistId: 'item',
                fieldId: 'item',
                value: 1261,
                forceSyncSourcing: true
             } )
             // Add item description
             rec.setCurrentSublistValue(
             {
                sublistId: 'item',
                fieldId: 'description',
                value: 'Charge Description'
             } )
             // Add item quantity
             rec.setCurrentSublistValue(
             {
                sublistId: 'item',
                fieldId: 'quantity',
                value: 1,
                forceSyncSourcing: true
             } )
             // Add Estimated Unit Cost F/X
             rec.setCurrentSublistValue(
             {
                sublistId: 'item',
                fieldId: 'custcol_est_unit_cost_fx',
                value: handlingBuy,
                forceSyncSourcing: true
             } )
             // Add Margin
             rec.setCurrentSublistValue(
             {
                sublistId: 'item',
                fieldId: 'custcol_orig_rate',
                value: handlingSell,
             } )
             // Commmit The Item
             rec.commitLine(
             {
                "sublistId": "item"
             } );
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!