Scenario: You have a country’s internal ID. You have to get the ISO code for that particular country. This can be done using a simple suiteQL code.
Code:
let suiteql = `SELECT id FROM country WHERE uniquekey = ${requestBody.country}`;
let queryResult = query.runSuiteQL({ query: suiteql }).asMappedResults();
let country=queryResult[0].id;
Working:
Here the queryResult returns an array of objects with key as id and value as the ISO code.
NB: Note that the N/query module should be declared for using suiteQL.