Hey everyone, I'm using ".getValue" for a field on...
# suitescript
r
Hey everyone, I'm using ".getValue" for a field on my newRecord. (This is working) Wondering how to get the value of a field inside of the field with record type "list/record" on my newRecord. Such as var replyRecord = context.newRecord; var newValue1 = replyRecord.getValue('customrecordfield1'). Trying to get 'customrecordfield1.customfield2.'
s
I believe you are saying you want the text of what is associated in that field?
newValue1
should be the internalid of the list/record set in that field. Depending on the context, you might have to run a lookup to get the text value. Otherwise you can try
.getText()
instead of getValue(). Not sure if I am understanding your dilemma
r
getValue works for getting the value inside of 'customrecordfield1'
I'm wondering how to get a value inside of customrecordfield1 if this is a link to another record such as a customer/contact and you now need a text field value
b
not a thing
s
The information on the joined record is not sitting in the field on your record. Search.lookupFields() is most likely what you wanna do.
b
either add another field that uses sourcing to get the value you want
or do a search or load the record to get the value
r
Ok, I might try the search.lookupfields()
thanks @battk @Sandii always helping me out ha
Hey @Sandii @battk I was able to get this returned: {"fieldvalue1":"100864"} when I try to pass this in for another value it shows as [object Object]. How could I just get to the value 100864 to use in another function?
r
You do Object.fieldvalue1
s
yeah but getValue() should not be returning an object
r
I think he is using search.lookupfields() which is why it is an object
r
Hey @Sandii @rustyshackles I am using 'var fieldLookUp = search.lookupFields({'
b
then its an object, and you would access its properties using either dot or bracket notation
s
Yeah, as rusty suggested,
search.lookupFields()
returns an object with multiple properties (since you can retrieve multiple fields); if what the field you are looking up is just text, then just read the property from the returned object (yours looks like just text). In the future, if the field is a list/multiselect, then you it should come back as an array with a
value
and
text
property.
r
Thank you @Sandii @rustyshackles @battk with your help I have finished initiating a workflow from a different record type's workflow (on create). Thank you!