Hi,
I would like to get a saved search results on clicking a custom button on estimate record. I have created suitelet and userevent scripts to load and show results of the savedsearch when the custom button is clicked. However when I click the button, a blank page is opening not the savedsearch results:mad: Can anyone please suggest where am I doing wrong.
Suitelet:
function Update_TermsandCond(request, response){
var recid = request.getParameter('id');
var rectype = nlapiGetRecordType();
if (recid != null && rectype != null) {
var rec = nlapiLoadRecord(rectype, recid);
var quoteid = rec.getFieldValue('tranid');
var quoteref = 'Quote' + ' ' + '#' + quoteid;
nlapiLogExecution('DEBUG', 'quoteref', quoteref);
var s = nlapiLoadSearch('customrecord_terms', 'customsearch_quote_terms_and_condit');
s.addFilter(new nlobjSearchFilter('customrecord_terms_quote_trans', null, 'is', quoteref));
s.setIsPublic(true);
s.saveSearch('My new Terms and Cond search', 'customsearch_quote_terms_and_condit');
var SearchURL = s.setRedirectURLToSearchResults();
}
}
Userevent to call suitelet:
function TermsandCond_Button(type, form, request){
{
if (type=="view")
{
if(nlapiGetContext().getExecutionContext()=="userinterface")
{
var printURL2 = nlapiResolveURL('suitelet', 'customscript_quote_updatetcs', 'customdeploy_quote_updatetcs');
printURL2 += '&id=' + nlapiGetRecordId();
nlapiLogExecution('DEBUG', 'printURL2', printURL2);
form.addButton('custpage_button','Terms and Conditions','window.open(\''+printURL2+'\',\'width=850,height=500,menubar=1,resizable=1,scrollbars=1\')');
}
}
}
}