I have a custom button on a Suitelet and I'm tryin...
# suitescript
s
I have a custom button on a Suitelet and I'm trying to execute a function from a Client Script. However, the button doesn't seem to be working. Can someone help me figure out what I am doing wrong? Client Script:
Copy code
/**
 *@NApiVersion 2.x
 *@NScriptType ClientScript
 */
define(['N/error'],
    function(error) {
        function pageInit(context) {
            if (context.mode !== 'create')
                return;
            var currentRecord = context.currentRecord;
        }
        function startOver(){

            var record = currentRecord.get();
            var recId = record.id;
            var recType = record.type
            var suiteletURL = url.resolveScript({
                scriptId:'customscript_sk_inventory_splitter_suite',
                deploymentId: 'customdeploy_sk_inventory_splitter_suite',
            });
            document.location=suiteletURL;
        }
        return {
            pageInit: pageInit,
            startOver:startOver
        };
    });
Suitelet:
Copy code
var assistant = serverWidget.createAssistant({
    title : 'Assistant'
});
assistant.clientScriptId = 522;

//
//
//
  form.addButton({
         id: 'custpage_startover',
         label: 'Start Over',
         functionName: 'startOver()'
       });
b
your suitelet code is inconsistent
it shows code for both an assistant and a form
s
Thank you for pointing that out. I'll try remove assistant and try with "form"