I was writing a client script for work and part of it involved getting getting the value of the cost category's text to display to the user. Unfortunately, that seems to only be a server side function. I've seen some posts about how to accomplish this in Suitescript 2.0, but for whatever reason, I can't seem to get Suitescript 2.0 scripts to work on Netsuite. Is there any way to run the getFieldText function from the client side script in 1.0?
Asked
Active
Viewed 569 times
1 Answers
1
I was able to use a separate Suitelet script to get the job done.
Code from the suitelet:
function getFTxt(request, response){
try{
var recordid = request.getParameter('rid');
var recordtype = request.getParameter('rt');
record = nlapiLoadRecord(recordtype, recordid);
var fieldName = request.getParameter('fn');
fieldText = record.getFieldText(fieldName);
response.write(fieldText);
}
catch(e){
var err = '';
if ( e instanceof nlobjError ){
err = 'System error: ' + e.getCode() + '\n' + e.getDetails();
}
else{
err = 'Unexpected error: ' + e.toString();
}
var errmsg = 'Error: ';
errmsg+= '\n' + err;
nlapiLogExecution( 'ERROR', 'Error is: ', errmsg);
response.write("");
}
}
Code from my original script:
function getFieldText(field,item){
var url = nlapiResolveURL('SUITELET', 'customscriptScriptIdGoesHere', 'customdeployDeployIdGoesHere') + '&rid=' + item.getId() + '&rt=' + item.getRecordType() + '&fn=' + field;
var response = nlapiRequestURL(url);
return response.getBody();
}
Then, whenever I wanted to get the field text for an item, I'd call that function from within the script. be sure to replace the script and deployment id to that of the suitelet.

Nick the coder
- 309
- 3
- 8