Suitescript 2.X: Getting standard lists IDs – SDF XML

Hello guys, I think I might be onto something.

Recently I needed to create a select field in a Suitelet whose source was all the saved searches in the system, most of the solutions that I found in the web suggest to create a saved search that returns all the saved search and then populate the field options. By searching a little bit deeper I stumbled upon this reddit post: https://www.reddit.com/r/Netsuite/comments/esb9hj/need_help_with_suitelet/

Which basically tells us to insert the value “-119” inside the “Source” option inside form.addField, example:

var field = form.addField({id : 'custpage_abc_text',type : serverWidget.FieldType.TEXT,label : 'Text',source: -119 });

I was quite happy to find that it works perfectly, but a question arose: where can I find all the internal IDs of Netsuite standard lists?

On the web, there weren’t questions of this kind, nor any information (maybe I didn’t search well enough). By searching “-119” on Ntetsuite’s help page, something really interesting appeared to me. You can find it by following this path inside of the help:

“SuiteCloud Platform -> SuiteCloud Development Framework -> SuiteCloud Development Framework XML Reference -> Lists For SDF Custom Object XML Definitions -> script_returnrecordtype”

Unfortunately, I wasn’t able to find a public link to this help page.

If you access it, this is an extract of the page content:

script_returnrecordtype

Possible Values

-10

-100

-101

-102

-103

-104

-105

-106

-107

-108

-109

-110

-111

-112

-113

-114

-115

-116

-117

-118

-119

-120

-121

-122

-123

-124

-125

-126

-127

-128

-129

-130

CONTINUES…

It contains -119, so I supposed that this is what the number I inserted in the script was referring to.

Unfortunately, there doesn’t seem to be a table that references those IDs to the related record.

Does any one of you know how to get this reference or shall I try every ID and create a table?

I think that mapping these values to the related records would really help the community by simplifying the scripting process, making it quicker to reference standard lists/records.

Thank you in advance, your responses are always very valuable. If we help each other we can reach a greater knowledge!

Rookie Asked on December 11, 2023 in Other.
Add Comment
2 Answer(s)

If you create a new field that is of type list/record and have the advanced field help chrome extension installed you can click through the label and see the list.

Advanced Field Help
(See the image)

LIST INTERNAL IDS AND LABELSa screenshot of the field help when adding a new list/record field that shows the internal ids and name of the records.

Not sure if there’s a way to access these unless you’re prepared to hack the DOM.

Beginner Answered on December 12, 2023.
Add Comment

further to this if you have the window open you can right click and inspect it.

in the console if you paste:

 

const table = document.getElementById('dataOptionsTable');
// Initialize an object to store the extracted data

const jsonTable = {};
// Iterate through each row of the table (skipping the header row)

for (let i = 1; i < table.rows.length; i++) {

// Get the content of the second and first td in the current row

const key = table.rows[i].cells[1].textContent.trim();

const value = table.rows[i].cells[0].textContent.trim();
// Add the key-value pair to the object

jsonTable[key] = value;

}
// Now, 'jsonTable' contains the desired data in the specified format

console.log(jsonTable);

This will log out JSON where the record name is the key and the id is the value.

 

Beginner Answered on December 12, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   SuiteMigration   Become a Sponsor