Mark C
09/16/2021, 6:07 PMform.addSubmitButton({
id: 'custpage_openform',
label: 'Submit',
functionName: 'openSuitelet'
});
form.clientScriptModulePath = 'SuiteScripts/Suitelets/cs_fulfill_delete_param.js';
log.debug({title:'CS Script ID', details: form.clientScriptModulePath });
context.response.writePage(form);
}
return {
onRequest: onRequest
};
});
CLIENT: Using N/currentRecord, N/url, and N/https
function pageInit(context) { };
function openSuitelet(context) {
var currentRecObj = currentRecord.get();
log.debug({ title: 'Current Record Get', details: "This function was called"});
var warehouse = currentRecObj.getValue({
fieldId: 'custpage_warehouse'
});
var admincode = currentRecObj.getValue({
fieldId: 'custpage_admincode'
});
var suiteletURL = url.resolveScript({
scriptId: 'customscript_br_sl_fulfill_dele_execute',
deploymentId: 'customdeploy_br_sl_fulfill_dele_execute',
returnExternalUrl: true,
params: {
warehouse: warehouse,
admincode: admincode
}
});
}
return {
pageInit: pageInit,
openSuitelet: openSuitelet
};
SUITELET B (Search)
function onRequest(context) {
var form = serverWidget.createForm({
title : 'Item Fulfillments to be Deleted'
});
if(context.request.method == 'GET'){
var requestparam = context.request.parameters;
var warehouse = requestparam.warehouse;
var admincode = requestparam.admincode;
var fulfillSearch = search.create({ //etc...
I think I've stumbled onto one part, which is in the Suitelet B, having the parameters in the script record (forgot that). But if so, so I call/use the internal IDs for those (e.g. warehouse : custparam_warehouse) in the search filter?
Still a rookie at this stuff-I know enough to be dangerous, but this is my first multi script project and I know I'm missing something easy.Sandii
09/16/2021, 6:25 PMSandii
09/16/2021, 6:28 PMSandii
09/16/2021, 6:32 PMif (context.request.method == 'GET') {
// render initial form
// add a submit button (that will take you to page 2)
context.response.writePage(form);
} else {
// check for the 2 parameters you are looking for with context.request.paramaters
// if they exist, render page 2
// else (assuming there is some action they can take from page 2) handle POST from page 2
}
Mark C
09/16/2021, 7:06 PMMark C
09/16/2021, 7:06 PMNicholas Penree
09/16/2021, 8:07 PMsuiteletURL
after you resolve the url?Nicholas Penree
09/16/2021, 8:09 PMMark C
09/16/2021, 8:20 PMNicholas Penree
09/16/2021, 8:22 PMNicholas Penree
09/16/2021, 8:22 PMsuiteletURL
and the method exits, so I wouldn't expect anything to happen when you click the buttonMark C
09/16/2021, 8:23 PMNicholas Penree
09/16/2021, 8:23 PMMark C
09/16/2021, 8:32 PMNicholas Penree
09/16/2021, 8:33 PMNicholas Penree
09/16/2021, 8:34 PMfunction onRequest(context) {
const {
method,
parameters: {
transid,
chgtype,
ocrid,
},
} = context.request;
const isNew = !nsutil.isEmpty(transid) && !nsutil.isEmpty(chgtype);
const isView = !nsutil.isEmpty(ocrid);
if (method === 'GET') {
if (isNew || isView) {
return renderForm(context);
}
renderList(context);
} else if (method === 'POST') {
return handleForm(context);
}
}
Mark C
09/16/2021, 9:06 PMMark C
09/17/2021, 9:52 PMMark C
09/17/2021, 9:53 PMvar suiteletURL = url.resolveScript({
scriptId: 'customscript_br_sl_fulfill_dele_execute',
deploymentId: 'customdeploy_br_sl_fulfill_dele_execute',
returnExternalUrl: false,
params: { 'warehouse': warehouse,'admincode': admincode }
});
window.onbeforeunload = null;
location.href = suiteletURL;
battk
09/17/2021, 10:01 PMbattk
09/17/2021, 10:02 PMbattk
09/17/2021, 10:03 PMbattk
09/17/2021, 10:04 PMbattk
09/17/2021, 10:09 PMbattk
09/17/2021, 10:09 PMbattk
09/17/2021, 10:10 PMMark C
09/17/2021, 10:18 PM