function beforeLoad(context) { try { ...
# administration
m
function beforeLoad(context) { try { var form = context.form; log.debug(‘context type’, context.type); var delegateTo = form.getField({ id : ‘custentity_sas_delegation_delegateto’ }); log.debug(“field is “, delegateTo); delegateTo.updateDisplayType({ displayType : serverWidget.FieldDisplayType.NORMAL }); log.debug(“display set”); } catch (error) { log.debug(‘Error’, error); throw error; } } return { beforeLoad: beforeLoad }; });
s
Not sure what the problem is, why can't you just do the same thing for the other fields?
m
Ah sorry, rubbish explanation. I’m not great at Javascript, and I was wondering how I added in the other 2 fields to that code. I’ve figured out i can just copy and paste the bulk of the try statement though and add my other fields in 🙂
s
If you are looking for a way to make it more concise, something like this would be fine
Copy code
['fieldId1', 'fieldId2', 'fieldId3'].forEach(function (fieldId){
    context.form.getField({
        id: fieldId
    }).updateDisplayType({
        displayType: serverWidget.FieldDisplayType.NORMAL
    });
})
Also, it is a simple script, but I would have recommended posting this in #C29HQS63G over admin channel
m
ah brilliant, thank you for the help