I'm chasing a 2010.2 related bug in our account and it appears that the behavior of redirecting and user event Before Load even scripts has changed. As you know a read-only copy is provided in a beforeLoad event so our tools were loading up fresh writable copies, writing and then redirecting so the user would see the new changes. This has worked fine for 3-4 years now. Until 2010.2. Now it appears that operations performed in a beforeLoad are wrapped in a transaction that is rolled back if you redirect from that operation. In other words it "undoes" the changes.
Here is some code that (I think) proves this. Before I sound the alarm at NetSuite (we have a couple critical scripts that are failing because of this) I thought I would check with all of you to see if anyone else has experienced this?
function OnBeforeLoad(type, form, request) { var isRedirected = request.getParameter('custparam_yourefired') || 'F'; if(isRedirected === 'F') { // We are in a before load context and as such we have a read-only // record instance which, for this example is useless. Load up a // fresh copy of record goodness so we can write some values! var freshCopy = nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId()); freshCopy.setFieldValue('custrecord_physorder_mu_patient_name', 'all-riiiight...'); nlapiSubmitRecord(freshCopy); // Load up an even FRESHER copy to see if that write operation really // happened var theFreshestEver = nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId()); nlapiLogExecution('DEBUG', theFreshestEver.getFieldValue( 'custrecord_physorder_mu_patient_name')); // Redirect back to this same record so the changes we just saved are // presented to the user. nlapiSetRedirectURL('RECORD', 'customrecord_physorder', nlapiGetRecordId(), false, { custparam_yourefired: 'T' }); } return; First request, we write value to a record then redirect, second request (from redirection) is just passing through... The data IS written to the DB because the super-fresh copy is correctly printing the value to the output.When this code runs, the value that is written is discarded after the redirect. This is a substantial change that I did not see documented ANYWHERE.