Query for custom field with type Select

There is a sublist field in a suitelet which is a list. The value of the list is to be the accounts with ELIMINATE INTERCOMPANY TRANSACTIONS checkbox checked. The search was not giving the field ELIMINATE INTERCOMPANY TRANSACTIONS checkbox. So, a query has been created as below.

Note: The module N/query is to be used.

 function accountListData(accountname) {
  //accountname is the object of the custom field
    var param0 = true;
    var sql = "SELECT BUILTIN_RESULT.TYPE_INTEGER(ACCOUNT.ID) AS ID, BUILTIN_RESULT.TYPE_STRING(ACCOUNT.displaynamewithhierarchy) AS displaynamewithhierarchy FROM ACCOUNT WHERE ACCOUNT.eliminate = ? ";


    /*********************************** */


    // Run the query
    var resultSet = query.runSuiteQL({ query: sql, params: [param0] });
    var results = resultSet.results;
    for (var i = results.length - 1; i >= 0; i--) {
      log.debug(i, results[i].values[0]);
      accountname.addSelectOption({
        value: results[i].values[0],
        text: results[i].values[1]
      });
    }


  }

Leave a comment

Your email address will not be published. Required fields are marked *