【问题标题】:NetSuite - Get Transaction Type using suite script APINetSuite - 使用套件脚本 API 获取事务类型
【发布时间】:2016-11-01 14:34:14
【问题描述】:

如何使用套件脚本 API 获取交易类型?基于获取的值想要执行逻辑。是否可以获取交易类型?

   function afterSubmit(type) {
            if (type == 'create' || type == 'edit') {
                //how to get transaction type(transType) so that I can use in the condition???
                if (transType == 'SalesOrd') {

                    var toemail = nlapiLookupField('customer',
                            nlapiGetFieldValue('customer'), 'email');
                    nlapiLogExecution('DEBUG', 'ToEmail', toemail);
                    var emailSubject = 'Hello World';
                    var emailBody = 'Hello World Message';
                    var fromId = -5;
                    nlapiSendEmail(fromId, toemail,
                            emailSubject, emailBody, null, null, null, null);

                }// if
                else

                if (transType == PurchOrd) {
                    var toemail = nlapiLookupField('customer',
                            nlapiGetFieldValue('customer'), 'email');
                    nlapiLogExecution('DEBUG', 'ToEmail', toemail);
                    var emailSubject = 'Hello World';
                    var emailBody = 'Hello World Message';
                    var fromId = -5;
                    nlapiSendEmail(fromId, toemail,
                            emailSubject, emailBody, null, null, null, null);

                }
            }// end

    }

-谢谢

【问题讨论】:

    标签: netsuite


    【解决方案1】:

    可能有几十种方法。以下是一些:

    在 SS1 中:

    var myRecordType = nlapiGetRecordType(); //gives you the internal id ie: 'salesorder' etc
    

    var myRecord = nlapiGetNewRecord();
    var myRecordType = myRecord.getFieldValue('type') //as above
    

    在 SS2 中:

    var myRecord = context.newRecord;
    var myRecordType = myRecord.type; //value from the record.Type "enum" ie: SALES_ORDER
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多