Add Warning Message in Sales Order using UserEvent Script

If you want to show warning message in sales order when selecting a particular checkbox, use the following code in UserEvent Script.

Must include the module N/ui/message and give newRec type is sales order.

let newRec=scriptContext.newRecord.

let cusField=newRec.getValue({fieldId:’fieldid’});             

if(cusField)   {           

  let myMsg = message.create({                         

title: “Title”, 

  message: ‘Message’,                         

type: message.Type.WARNING,                                               

 });                   

    scriptContext.form.addPageInitMessage({message: myMsg});

}

In the ‘fieldid’, you give your fieldid and give required details in ‘Title’, and ‘Message’. The message types are CONFIRMATION, INFORMATION ,WARNING and ERROR.

Leave a comment

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