Pulling my hair out at something that is probably ...
# suitescript
s
Pulling my hair out at something that is probably staring me in the face.... I have a Suitelet for a form that when submitted, creates a custom record. This works as intended, but I am trying to incorporate a back button onto the Suitelet, and from what I am reading, I need to use a client script. I am unable to get the client script to run on the Suitelet. I have confirmed that the form.clientScriptModulePath on the Suitelet is filling out with the correct info, but I can't get any function to run from the client script by using that button. Any assistance in troubleshooting why is appreciated! Code in the comments.
Client Script - it doesn't have the correct code for the back button to work, but something simple for me to even see the client script run
Copy code
define(['N/record', 'N/url', 'N/log', 'N/currentrecord'],
function(record, url, log, currentRecord) {
    function pageInit(context) {
    }

    function backButton() {
        try {
            var rec = currentRecord.get();
            log.debug("current record", rec)
            rec.setValue({
                fieldId: 'custpage_notes',
                value: 'I clicked backButton'
            })
        } catch (e) {
            log.error("error", e);
        }
    }

    return {
        pageInit: pageInit,
        backButton: backButton
    };
});
My Suitelet has the below relevant code:
Copy code
form.addButton({
            id: 'back',
            label: 'Back',
            functionName: 'backButton'
        })

        form.clientScriptModulePath = 'SuiteScripts/CL_backButton.js';
b
you arent paying enough attention to your console
open the developer console of your browser and find the error that is being thrown
❤️ 1
s
That is exactly the direction I needed, thank you!