Hello all,
In SuiteScript 1.0 we were able to add buttons to NetSuite forms in inline html fields. These buttons would then usually bring up a window with some other info. So now I am trying to do the same type of thing 2.0.
I have a User Event script and the button is showing up on the form.
function beforeLoad(scriptContext) {
//Components button
var newInlineHtmlField = scriptContext.form.addField
({id: 'custpage_pe_componentsbtn_inline',
type: 'inlinehtml',
label: ' '
});
newInlineHtmlField.defaultValue = '<br/><input id="btnPEComponentsList" onclick="onclick_showComponentList();" type="button" name="btnPECompList" value=" Components " style="width:150px; height:30px; cursor: pointer; background-color:#378FFA;border:1px solid #9DBFF2; color:#FFFFFF; font-weight: bold;">';
scriptContext.form.insertField({field: newInlineHtmlField, nextfield: 'printitems'});
}
Then like before we have a Client Script with a function to open the window when the button is clicked. Problem is nothing happens. I added an alert just to see if function was even being called and nothing happens. I also added an alert in the init function to make sure the script was attached to the form and it is. Any ideas why the onclick function is not being called?
function onclick_showComponentList()
{
alert("in");
var strCurItem = currentRecord.getField({fieldId: itemid})
window.open("http://tools.parts-express.com/QIL/QuickItemLookup.aspx?item=" + strCurItem + "&source=so", "_blank", "width=1500, height=800, top=100, left=50, scrollbars=yes");
}
FYI, we want this button in a specific place on the form not at the top and bottom with other NetSuite buttons. That is why using the inline html.
Thanks all!!!
Karen