Can you make a standard mandatory field not mandat...
# suitescript
m
Can you make a standard mandatory field not mandatory using suitescript? I am trying to do it with a client script, but it doesn't work... this is my code:
Copy code
function lineInit(context) {
    let rec = context.currentRecord;
    let sublistID = context.sublistId;

    if (sublistID === "item") {
      let fld = rec.getCurrentSublistField({
        sublistId: sublistID,
        fieldId: "estimatedamount",
      });
      fld.isMandatory = false;
    }
  }
c
I'm not sure that you can set that for standard fields?
only mutable for fields created via N/ui/serverWidget - which means custom fields.
I don't know if a UserEvent script meets your requirements but you can ignoreMandatoryFields = true when you call record.save().
m
I think it doesn't work with sublists because there are no lines, you won't be able to loop on anything to reach the field in the first place.