Can you display a button on the Item sublist on a ...
# suitescript
k
Can you display a button on the Item sublist on a sales order in view mode? Not in edit mode.
e
You can use the beforeLoad event on a UE script to create a button on the item sublist tab.
k
I have this current code and its not displaying.
Copy code
const beforeLoad = (scriptContext) => {

if(scriptContext.type === scriptContext.UserEventType.VIEW){
    var form =  scriptContext.form
    var record = scriptContext.newRecord
    var sublist = form.getSublist({id: 'item'})

    sublist.addButton({
        id : 'custpage_button_id',
        label : 'Test',
        functionName: ""
    });

    log.debug("type", scriptContext.type)
    log.debug("type", scriptContext.UserEventType.VIEW)

     }
     }
m
I don’t think .getSublist is a method in form. I can’t search the help docs right now, but are you trying to add the button on a tab maybe?
k
I am trying to put a button on the item sublist in view mode