How can I set a field mandatory before load?
# suitescript
a
How can I set a field mandatory before load?
b
a
@battk thanks, but it didn't work beforeLoad and if you set it in client script it will ignore it.
You can see the red star but you can save it without value
b
you can try sharing your code, but you dont have any other choice in the beforeLoad
a
It's a custrecord field
I'm just using getField().isMandatory
b
you can try sharing enough so that i can recreate whatever you are doing
a
@battk const rate = ctx.newRecord.getField({fieldId: ""}) rate.isMandatory = true
b
go though the documentation i linked
the isMandatory from serverWidget is not view only
a
Not view only?
b
in more technical terms, the serverWidget's isMandatory has a setter function associated with it
the isMandatory from the record module does not
a
Thanks
w
so the working way was?:
scriptContext.form.getField({fieldId:"the_field"}).isMandatory = true;
a
True