hi in a UE script when i try to set the value of a...
# suitescript
m
hi in a UE script when i try to set the value of a name field with the selected option of a SELECt field, it fails in CREATE mode and it works in EDIT mode
b
you're trying to use getText() ?
m
yes
becasue i need the text value of teh SELECT
not the actual value
b
it's a pain, but you can't perform a getText() on a field if it hasn't been saved yet
m
are you kidding me?
so i should move it to a after submit then?
b
nope; the way around it is to do a search.lookupFields() to get it
you can also do it after Submit, but in that case you'll end up with a double-save
m
yes
b
so either do a lookup in beforesubmit; or a double-save by having it in aftersubmit
m
what is your other suggestion i have not understood sorry
b
the beforeSubmit is more efficient
say that the SELECT field is called "xxx"
right now you're going var X = context.newRecord.getText("xxx")
now, instead, you'll do var X = search.lookupFields({type: "whatever the record/list type is", value: context.newRecord.getValue("xxx"), columns: ["name"]}).name;
m
got it
thnanks for the tip