XochisSketches
04/14/2021, 7:01 PMjen
04/14/2021, 7:07 PMjen
04/14/2021, 7:09 PMjen
04/14/2021, 7:09 PMvar script_id = 123;
var deployment_id = 1;
var params = {tx_id: tx_id};
var suitelet = url.resolveScript({scriptId: script_id, deploymentId: deployment_id, params: params});
context.form.addButton({
id: 'custpage_call_sl_button',
label: 'Call Suitelet',
functionName: 'openURL("' + suitelet + '")'
});
XochisSketches
04/14/2021, 7:10 PMXochisSketches
04/14/2021, 7:11 PMdefine(['N/record', 'N/log', 'N/redirect', 'N/ui/serverWidget', 'N/url'],
function (record, log, redirect, ui, url) {
function beforeLoad(context) {
if (context.type == context.UserEventType.VIEW)
{
var form = context.form;
form.addButton({
id: 'custpage_btn_call_docengine',
label: 'Export',
functionName: "openWindow(" + context.newRecord.id + ");"
});
if (context.newRecord.getValue('custrecord_sc_inforouter_doc1_guid'))
{
form.addButton({
id: 'custpage_btn_call_inforouter',
label: 'View Doc 1',
functionName: "openWindowIR(" + context.newRecord.getValue('custrecord_sc_inforouter_doc1_guid') + ");"
});
log.debug({
title: 'we made it button',
details: context.newRecord.getValue('custrecord_sc_inforouter_doc1_guid')
});
}
context.form.clientScriptModulePath = "SuiteScripts/Libraries/docengineclient.js"
}
}
return {
beforeLoad: beforeLoad
};
});
XochisSketches
04/14/2021, 7:11 PMXochisSketches
04/14/2021, 7:11 PM/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(["N/ui/dialog", "N/log", 'N/url'], function (dialog, log, url) {
function pageInit(context) {
// This function should always remain blank.
}
function openWindow(intID) {
var scriptURL = url.resolveScript({
scriptId: 'customscript_sc_bs_docengine',
deploymentId: 'customdeploy1',
returnExternalUrl: false,
params: { "jrecid": intID }
});
log.debug({
title: 'we made it',
details: scriptURL
});
window.open(scriptURL);
}
function openWindowIR(intID) {
var scriptUR = url.resolveScript({
scriptId: 'customscript_sc_ir_suitelet',
deploymentId: 'customdeploy1',
returnExternalUrl: false,
params: { "jrecid": intID }
});
log.debug({
title: 'we made it',
details: scriptUR
});
window.open(scriptUR);
}
return {
pageInit: pageInit,
openWindow: openWindow,
openWindowIR: openWindowIR
}
});
XochisSketches
04/14/2021, 7:12 PMjen
04/14/2021, 7:14 PMfunctionName: "openWindowIR(" + context.newRecord.getValue('custrecord_sc_inforouter_doc1_guid') + ");"
});
jen
04/14/2021, 7:15 PMfunctionName: "openWindowIR(value);"
});
jen
04/14/2021, 7:15 PMjen
04/14/2021, 7:15 PMjen
04/14/2021, 7:16 PMcontext.newRecord.getValue('custrecord_sc_inforouter_doc1_guid')
is returning what you expectjen
04/14/2021, 7:17 PMXochisSketches
04/14/2021, 7:18 PMjen
04/14/2021, 7:19 PMjen
04/14/2021, 7:19 PMjen
04/14/2021, 7:19 PMXochisSketches
04/14/2021, 7:22 PMbattk
04/14/2021, 7:23 PMXochisSketches
04/14/2021, 7:25 PMXochisSketches
04/14/2021, 7:26 PMbattk
04/14/2021, 7:27 PMbattk
04/14/2021, 7:28 PMbattk
04/14/2021, 7:29 PMbattk
04/14/2021, 7:29 PMXochisSketches
04/14/2021, 7:32 PMXochisSketches
04/14/2021, 7:33 PMbattk
04/14/2021, 7:59 PM