Search code examples
netsuite

Issues regarding calling a custom function in a Netsuite CS script on button click


I added a button to my employee form via a UE script to which I bound the 'createDebtor' function, which I made in the CS script which I attached to my UE script.

I am not really familiar with this method yet and run into some errors in my CS script. The following is the start of my CS script: enter image description here

I added both console and script logging, because the script logging did not work. Note that the alert function works, so the initialization of the code and binding of the function works correctly. I have the following questions regarding my code:

*Why does log.debug not work (I am owner of the script and the script deployment has debug log level and testing status)

*Trying to console.log the 'employee' variable returns a readOnly object with the methods like 'getvalue', but no properties containing data. Is there an easy way to obtain and log all the properties of this object?

*As a followup to the previous question I tried to use the 'getValue' function to obtain data, but this returns 'undefined' for the 'subsidiary' field. (the field ID should be correct, as I got it from the employee form itself). Could someone advice what I am doing wrong here?


Solution

  • Suite Answers 68476, 74121, and 10564 suggest that you try/confirm the following:

    1. In the User Event script, call form.setScript() before form.addButton().
    2. Check the execution log of the User Event script, not the Client Script.
    3. Confirm that the Log Level is set correctly, I assume on the User Event script and the Client Script.