Hello, hope everyone is doing well. I have a quest...
# suitescript
j
Hello, hope everyone is doing well. I have a question, that I thought would be easy but I cannot find the solution to. I need to clear a list/record transaction body field in either a client script or a user event script. I tried using setValue() with value: ‘’, or value: null and that isnt working. Any help would be greatly appreciated
s
That is strange. I just tested this, and was able to use both
rec.setValue({ fieldId: fieldId, value: '' })
and
rec.setText({ fieldId: fieldId, text: '' })
to clear a List/Record field in a client script. What happens when your code runs? Do you get an error, or does it just have no effect?
s
Also maybe check the field definition, its not a sourced field or something like that, right?
r
Record.save()
?
j
yeah, I’m setting this in a fieldChange entry point. so I dont want to call record.save(). and setting the value: ‘’ actually clears the field, but on save the field holds the old value
r
I haven't worked with fieldChanged in scripting. Can you
record.submitFields()
?
b
unless you are working with a field that cant be changed, you want to take a look at workflows or user event scripts on your record
✔️ 1
👍 1
s
Also, since this is a transaction, another thing you may need to look for is custom GL plug-ins. We actually have a SuiteGL plug-in from our tax engine that modifies and re-saves transactions when they are submitted (to add externally calculated tax values). It’s not common, and probably not best practice, but it is possible.