Wednesday, June 5, 2019

List of Internal ID Numbers of all Record Types

There is a custom field of type List/Record. The source List is "Record Type".
User would like to get list of all Record Type IDs (Numbers).

It is possible to create a loop script which will try to set all possible ID numbers to this custom field and then pull text values. This sample can be ran for example in Browser Console. See Example below. Please note that IDs have also negative values and the list is changed according to current number of Custom Record Types.

var idsAndNames = "";for (var i=-500;i<500;i++){     // set the value to the field of type List/Record - source  "Record Type"   nlapiSetFieldValue('custrecord_list_field',i);  // get the name of each Record Type  var recordName = nlapiGetFieldText('custrecord_my_list_field');  // if there exists a Record Type name for current id (i) > store add it into string variable  if (recordName != "") {    idsAndNames += i + " - " + recordName + ";";    }  }// print variable with IDs and related namesconsole.log(idsAndNames); 

No comments:

Post a Comment