title: NetSuite - Get Transaction Type using suite script API
body: <p>How to get Transaction Type using suite script API? Based on the fetched value want to perform logic.  Is it possible to fetch transaction type?               </p>
  
  <pre><code>   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
  
      }
  </code></pre>
  
  <p>-Thanks</p>