I have what I think is simple, but have nto been able to find the correct way of passing a variable from beforesubmit to aftersubmit userevent.
Here is my scenario.
Custom record which is linked to an event record. I want to make sure that the event is deleted if the custom record is deleted but don't want to rely on users to make sure they delete both.
My thought here was to create a user event script.
From the custom record if the users clicks delete the script would execute the before submit which would just get the eventid, then the custom record would delete, then the aftersubmit would execute a delete record on the caledar event using eventid.
When I tried this I received an error that the after submit did not recognize the eventid.
So I assume there is a way to pass this variable from the beforesubmit to aftersubmit.
If you can tell me what I am missing I'd appreciate it...is it script parameters?
function GetEvent(type) //before submit { if (type = 'delete') { var EventID = nlapiGetFieldValue('custrecord_support_event'); //get linked event to delete } } function DeleteEventRecord(type) //after submit { if (type = 'delete') { nlapiDeleteRecord('calendarevent',EventID); //delete linked event } }