I have a custom script on an address form and, whi...
# suitescript
s
I have a custom script on an address form and, while it worked earlier, it is now saying the context is undefined on saveRecord. Any idea why this is happening?
Copy code
define(["./ad_bl_validate_address"],
    function (vaAddress) {
        function saveRecord(context) {
            debugger;
            return vaAddress.validateAddress(context.currentRecord);
        }

        function pageInit(context) {
            // vaAddress.displayDialog();
            // context.currentRecord.setValue("state", 'GA')
        }

        return {
            // pageInit: pageInit,
            saveRecord: saveRecord
        }
    }
)
d
is this 2.1 suitescript Api version ? there is an error around context when attaching clientScript to Form on UserEvent/Suitelet
s
Yup 😞
Just updated it to 2.0 and it's still happening
d
so ya if you scroll up a bit on this channel, you can see some discussion on another thread
and ya I also had that issue as well when trying to revert back to v2.0 api jsdoc header the past - I think some aspect of the script is "cached"
s
Yeah. I removed it, saved it, added it back. Man, k you saved me a ton of time. That's been driving me bonkers. Sometimes it works, sometimes it doesn't
d
yeah I think that was the "easiest" way I got around it definitively - like created a copy of the attached script file to "break the link", then attached the form to that copy , then switched it back to the original one I wanted. if that makes any sense 😂
netsuite 1
s
lol it does. Fotunately this script doesn't need much from es6 so i'll leave it doesn't hurt too much this time to leave it as 2.0 lol