Hi all, I want to load a record based on user inpu...
# suitescript
h
Hi all, I want to load a record based on user input (input is internal id of record). It's record type is either noninventoryitem or a serviceitem. How would I do this with a promise? Is promise the right way to do this?
b
you are looking for a prompt
if looks are not a concern, you can use prompt
h
var recordType = search.lookupFields({ type: search.Type.ITEM, id: itemId, columns: ['baserecordtype'] });
I want to do something like this but baserecordtype is an invalid search column for ITEM
is it possible to access the recordtype with search.lookupfields?
b
use
recordtype
as the column
😀 1
h
That worked,Thank you!
var recordType = search.lookupFields({                           type: search.Type.ITEM,                           id: itemId,                           columns: ['recordtype']                       }); This returns an [object, Object] but when I try console.log("record Type "+ recordType[0].value); I get undefined error
I have also tried recordType[0].text but get undefined
b
you probably want to try using console.log(recordType) to have a look at what recordType looks like
its not an array
and it does not have value or text keys
h
This worked: var lookUpField = search.lookupFields({ type: search.Type.ITEM, id: itemId, columns: ['recordtype'] }); var recordType = lookUpField.recordtype;
Thank you for your help!