Hi Guys,
Sharing to you a snippet I made to quickly view the XML of the record.
Details: It adds two buttons, one will open the XML View on the same window, the other one will open it in a new tab hence the label NW.
/** * @NApiVersion 2.x * @NScriptType UserEventScript * @NModuleScope SameAccount */ define(['N/runtime','N/ui/serverWidget'], /** * @param {runtime} runtime * @param {serverWidget} serverWidget */ function(runtime,serverWidget) { /** * Function definition to be triggered before record is loaded. * * @param {Object} scriptContext * @param {Record} scriptContext.newRecord - New record * @param {string} scriptContext.type - Trigger type * @param {Form} scriptContext.form - Current form * @Since 2015.2 */ function beforeLoad(scriptContext) { var form = scriptContext.form; if(runtime.executionContext === runtime.ContextType.USER_INTERFACE) if(scriptContext.type === scriptContext.UserEventType.VIEW){ form.addButton({ label:'XML View', id:'custpage_xml_view', functionName:'nlapiChangeCall({"xml":"T"})' }); form.addButton({ label:'XML View NW', id:'custpage_xml_view_nw', functionName:'window.location = window.location.href+"&xml=T"' }); } } return { beforeLoad: beforeLoad }; }); Hope this help you in some way.Regards.