RE: What is the best method of passing values from BeforeSubmit to AfterSubmit portion of a User Event Script.
Hi,
My objective is to pass values from the BeforeSubmit and use it in the AfterSubmit portion of a User Event Script.
After reading some doc, I found the Cache module was a viable option. But is it the best method?
Context of full script below: automate the following workaround https://netsuite.custhelp.com/app/answers/detail/a_id/23967/kw/cash%20sale%20credit%20memo to apply a Credit Memo to a Cash Sale before Credit Card gateway process.
var myCache = cache.getCache({ name: 'temporaryCache', scope: cache.Scope.PRIVATE }); myCache.put({ key: 'usedCMIDs', value: JSON.stringify(usedCMIDs), ttl: 18000 }); var usedCMIDs = JSON.parse(myCache.get({ key: 'usedCMIDs', ttl: 18000 }));
Based on a SuiteAnswers article I found, this is a recommended method. [SS1.x] Pass a Value from the Before Submit to the After Submit Script
I tested the code myself and as @michoel pointed out about the not guaranteed TTL, this SESSION method does not have a TTL.
var sessionObj = runtime.getCurrentSession(); sessionObj.set({ name: "myKey", value: "myValue" }); log.debug("Session object myKey value: " + sessionObj.get({name: "myKey"});
mreser
Could you set a custom field in beforeSubmit with whatever you need, and then get the value in afterSubmit?