Hi all, From the Other Record Fields page I added...
# suitescript
c
Hi all, From the Other Record Fields page I added a free-form text field to the Account record. I am having trouble trying to retrieve these via a Restlet. The id that’s created is prefixed with ‘custrecord’, but it’s not obvious to me how I’d get the value stored.
b
Share your code
c
Well, I’ve tried a few different options and none seem to work.
Copy code
glAccount.test = glAccountRecord.getValue({fieldId: 'custrecord1394'});
glAccount.testData = glAccountRecord.getText({fieldId: 'custrecord1394'})
try{
      if(glAccountRecord.hasSubrecord({fieldId:'custrecord1394'})){
         log.debug({title: 'glAccount sub RECORD EXISTS', details: "WOOT!"});
       }

                        
   }catch(e){
         log.debug({title: 'glAccount.testData', details: glAccount.testData});
   }
b
your code for getting the value looks correct, assuming that your script id is correct
the logging code looks useless
keep in mind that there is no requirement that the script id of the field match the internal id
in fact, its best practice to set the script id to have an id that describes its purpose
c
Yea, I was just messing around with the logging. I’ll try setting the script id and see if that helps.
OK, so the above does work. It helps to ensure I am looking at the correct Account record when I am testing.