i want to disable or hide the field in a client sc...
# suitescript
v
i want to disable or hide the field in a client script, i used both field.isDisabled = true, field.isDisplay = false, but both not worked. anyone please help me?
n
At what point? Field change?
c
Share your code
v
no on saveRecord. Initially i had it in userevent beforesubmit, now changed to saveRecord.
c
Why are you trying to hide/disable fields in saverecord? It doesn't make any sense from a user point of view
💯 1
The record will save & redirect back to itself in view mode
🤭 1
Do you want to start with what you're trying to do as a business requirement (not your solution, the requirement), and we'll take it from there?
v
i have three exchange rate fields for EUR, USD, GBP. if the currency is EUR, i dont need the exchange rate of EUR, so i need to disable this field.Thi sisthe requirement
n
And you need to show hide when the currency changes? Do you need to hide this when the record loads also? You probably need a UE beforeLoad and a client script on change.
v
i tried beforeLoad, but the updateDisplayType didint work out there.
no the currency field cannot be changed, so no need of fieldchanged function
n
You should be fine to use beforeLoad in edit mode probably gonna struggle in view.
v
Cannot find function updateDisplayType in object Field
this is the error i get
n
and how did you get the field?
...and on edit?
v
record.getField('id')
n
you should be getting the field off the form
v
i am getting the custom field already created.
is that wrong?
n
not "record.", "form." You need to do let form = context.form. let myFieldObj = form.getField({fieldId:'custom_field_id'}); then update the display type
You're not updating the record field you're updating the field on the form.
v
ok sir thank you , it works