Script to add a field in a specific position in a record

//To add field
let employeeField = scriptContext.form.addField({
    id: 'custpage_employee',
    type: serverWidget.FieldType.SELECT,
    label: 'EMPLOYEE'
});

//display new field before another field
let objForm = scriptContext.form;
objForm.insertField({
    field: employeeField,   //The Field object to insert.
    nextfield: 'custrecord_jj_consumed_supervisor' // The internal ID name of the field you are inserting a field in front of.
});

Leave a comment

Your email address will not be published. Required fields are marked *