I am trying to run a search on a field change but ...
# suitescript
p
I am trying to run a search on a field change but only if a field (venue) in the salesorder has a value. I thought I could do the below but the search is still running (and producing an error because the filter is based on the value of the venue field which is empty:
Copy code
if((context.fieldId == 'custbody_adress_source)) {
                var addressSource = recCurrent.getText({ fieldId: 'custbody_address_source'});
            // Start Select Venue
            if ((addressSource == "Venue") && (Venue != "")){
What am I doing wrong?
j
To start off, you have your custbody_address_source spelled incorrectly in the beginning of the if statement and are forgetting a closing apostrophe. Additionally, how are you defining that Venue variable in the second if statement?
👆 1
p
thanks for the reply. found the reason it wasn't working. was a typo.
b
linters will tell you that you should be using strict equality
nothing good comes from using regular equality against the empty string