javascriptnetsuiteclientscript

Redirect client script to a record type


How do I get redirected to a record type after executing a command in a client script. Explaining better, I'm in a client script, and after clicking a button, a new record is generated in another record type, and I want to be redirected there.

Thank you

I need to leave this page after performing the procedures, and be redirected to the record I just created


Solution

  • var newType = <NetSuite ID of record type>;
    
      // making new record code
    
    var newId = newRecord.save();
    
      // performing the procedures
    
    // Requires the N/url module
    var output = url.resolveRecord({
        recordType: newType,
        recordId: newId,
        isEditMode: true
    });
    
    window.location.replace(output);