hello guys, i have a dropdown field in the child r...
# suitescript
m
hello guys, i have a dropdown field in the child record of a form. how to get the dropdown values. i tried the get value method but it returns the value 'undefined'
b
are you trying to get the select options of the field
or the value of the field itself
m
only the value of the field when its selected
b
and what code did you use
m
define([], function(){ /** @NAPiVersion 2.0 @NScriptType ClientScript @NModuleScope Public */ function showMessage(context) { var fieldId = context.fieldId; var currentRecord = context.currentRecord; var lvtype = currentRecord.getValue({ fieldId: 'custrecordu_lvetype' }); if (lvtype == '1') { currentRecord.setValue({ fieldId: 'custrecordu_lvename', value: 'Annual Leave 30', ignoreFieldChange: false }); } alert(lvtype); } return { fieldChanged: showMessage }; });
b
you would get an alert every time any field is changed
thats probably a lot of alerts
return early if the fieldId isn't the one you want your script to process
m
alert is for my reference only whether it is getting any value or not?
b
as in its hard to tell what field is being set if you alert everything
m
ok..
b
otherwise, everything looks fine
tried it on my account with code that returns early and it works if your weirdly named internal ids are correct
m
yeah but im not retrieving the value from child record dropdown field..
still its in the same error
b
not sure what you are describing
screenshots may help
m
message has been deleted
b
you dont use getValue for a sublist field
m
i also tried getCurrentSublist
b
what was the code for that
m
var type = currentRecord.getCurrentSublistValue({ sublistId: '', fieldId: '' });
i dnt knw why it is not getting the value from a child record field
b
did you get the internal ids correct?
m
yeah it is correct
b
what are they
m
fieldId: 'custrecordu_lvetype'
b
and the sublistId?
m
sublistId : customrecord_leve_dtls
b
thats not the sublist id
m
thanks a lot ya!.. its working