This topic contains 6 replies, has 0 voices, and was last updated by chanarbon 7 years, 11 months ago.

  • Author
    Posts
  • #1473

    CFong

    Is there a way to test SS 2.x script calls from the browser console?

    This is one of my favorite features of SS 1.0

    The ‘debug’ feature of NetSuite is fine, but it’s kinda cumbersome when you want to quickly test an idea.
    This is a cached copy. Click here to see the original post.

  • #1474

    david.smith

    I don’t think it’s officially supported but you can use this method:

    Code:
    require([‘N/record’,’N/search’],
    function(record,search){
    var s=search.create({ filters:[], columns:[], type:’inventoryitem’ });
    s.run().each(function(result){ console.log(result); return true; });
    var r=record.load({type:’inventoryitem’,id:15941});
    console.log(r);
    }
    );


    erictgrubaugh replied on 11/28/2016, 03:01 PM: Yep, all you do is wrap whatever 2.0 code you want to run in a `require` callback.

  • #1475

    michoel

    For ad-hoc debugging you can use the Chrome Developer Tools “Snippets” feature (note this needs to be run on a page with record in Edit mode):

    For debugging existing scripts, you can insert a JavaScript “debugger” statement into the code to create a breakpoint,

    Alternatively you can “require” the module in the browser console, inspect the resulting object and click “Show Function Definition” to open the source, and add the breakpoints there.


    CFong replied on 11/28/2016, 04:49 PM: There isn’t, yet, a way to check it on a *view* mode record?

  • #1476

    CFong

    Thumbs up to all of you! Thank you so much! all of these tips are invaluable to a SS and JavaScript newbie like myself!

  • #1477

    chanarbon

    You may use snippets feature also in View mode for snippets which are not interacting with the current record like setting the values and the the change visible right away like the snippet that David showed above

  • #1478

    CFong

    chanarbon So the “snippets” will still work so long as I don’t want to “update” the values, correct?

  • #1479

    chanarbon

    Hi @CFong,

    Yes. it should still be working with that kind of scenario.

You must be logged in to reply to this topic.