Anyone ever build a client script for a custom Ass...
# suitescript
d
Anyone ever build a client script for a custom Assistant?
How does the client script know what step its in ... and what event is triggered on the 'next' click that would allow me to validate the data being submitted?
b
not as useful as you might hope
entrypoints arent triggered
d
Well, not surprised .. that's for sure.
e
I used this var curStep = document.getElementById('curstep').value; var justAdded = document.getElementById('custpage_just_added');
d
Ok, so that gets you 'values' @Eric B
I'd like to validate those values on the click of 'Next', and block from proceeding if I don't like what I see in those values
Just when I thought I had this 'beast' Assistant tamed ....
b
its never tamed, you eventually get screwed when netsuite keeps track of state when you dont want it to'
d
So true
e
here's the code I used a while back...
if (curStep != undefined) {
switch(Number(curStep)) { case 1: /* need to grab this value using DOM because it isn't available via the context object*/ var id = document.getElementById('hddn_custpage_customer_fs').value; var name = document.getElementById('custpage_customer_display').value; var po = document.getElementById('custpage_purchasename').value; var paramPO = getParameterByName('po'); var sessionObj = runtime.getCurrentSession(); sessionObj.set({name: 'purchase_name', value: po}); sessionObj.set({name: 'customer_id', value: id}); var sessionScope = runtime.getCurrentSession().get({ name: 'scope' }); var po = sessionObj.get({name: 'purchase_name'}); var cust = sessionObj.get({name: 'customer_id'}); console.log('@saveRecord session objects', po, cust, sessionScope); console.log('paramPO', paramPO); //if the user came via the Assistant link if (id != '' && po != '') { if (isAdded != 'added') { var added = submitStep1(id, po, paramPO); console.log('added', added); return added; } else { return true; } } break; case 2: //client side validation here before it passes it to the POST on the SL //step 2 is triggered off of submitStep2 which redirects the the assistant SL /* var url = document.getElementById('entryformquerystring').value; var urlDomain = gsUtilities.getCurrentDomain(); console.log('urlDomain ' + urlDomain + url); //location.href = url;*/ return true; break; case 3: //client side validation here before it passes it to the POST on the SL //var url = gsUtilities.getScriptURL('customscript_gs_sl_edi_process_assistant','customdeploy_gs_sl_edi_process_assistant'); //console.log(url); return true; break; case 4: //client side validation here before it passes it to the POST on the SL var url = gsUtilities.getScriptURL('customscript_gs_sl_edi_process_assistant','customdeploy_gs_sl_edi_process_assistant'); console.log(url); break; case 5: //client side validation here before it passes it to the POST on the SL var url = gsUtilities.getScriptURL('customscript_gs_sl_edi_process_assistant','customdeploy_gs_sl_edi_process_assistant'); console.log(url); break; default: return true; } } else { showMessage('Process incomplete!', 'error'); return false; }
that's on the saveRecord function...
d
@Eric B, very solid of you to share that code. Appreciated
👍 1
b
thats more useful, i thought it didnt trigger entry points
👍 1