ディスカッション

NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!

RESTletを使用してクーポンコードが適用されている注文書を作成する

編集済:Jun 2, 2025 2:48PM SuiteCloud / カスタマイズ

適用

製品:  NetSuite 2020.1



シナリオ

ユーザーは、クーポンコードが適用されている注文書を外部システムで作成したいと考えています。



解決策

サンプルJSONパッケージ:

{"internalid":"1158","promocode":"Test Promotion 1","couponcode":"LE-Z4A","item":"6"} 

SuiteScript 1.0:

function TestRestLet(dataIn){ 
 nlapiLogExecution('DEBUG', 'data', JSON.stringify(dataIn)); 
 
 var record = nlapiCreateRecord('salesorder', {recordmode:'dynamic'}); 
 
 record.setFieldValue('orderstatus', 'B'); 
 record.setFieldValue('entity', dataIn.internalid); 
 record.selectNewLineItem('item'); 
 record.setCurrentLineItemValue('item', 'item', dataIn.item); 
 record.commitLineItem('item'); 
 
 if(dataIn.couponcode != null) 
 { 
  nlapiLogExecution('DEBUG', 'Promo code and coupon code: ', dataIn.promocode + ' ' +  dataIn.couponcode); 
  record.setFieldText('promocode', dataIn.promocode); 
  record.setFieldText('couponcode', dataIn.couponcode); 
 }  
  
 return nlapiSubmitRecord(record); 
}
 
SuiteScript 2.0:
 
function TestRestLet(requestBody){ 
 log.debug('data', requestBody); 
  
 var rec = record.create({ 
  type: record.Type.SALES_ORDER 
  isDynamic: true 
 }); 
  
 rec.setValue({ 
  fieldId: 'orderstatus', 
  value: 'B
タグ付けされた:

ようこそ!

サインイン

完全な詳細を表示するには、サインインしてください。

登録

アカウントがありませんか?ここをクリックして始めましょう!

リーダーボード

コミュニティの達人

第 1 四半期 (1月~3月 2026)

今週のリーダー

今月のリーダー

歴代リーダー