Set Field Value from Suitelet Popup Called from Client Script

Scenario:

A client side script on a transaction record calls a popup Suitelet that lets you search and select an item. After selecting the item from the Suitelet, it should then set the item to the line item of the transaction record.

Solution:

There should be data flow from Client script applied to Suitelet form interaction and the other Client script deployed in transaction record which created the popup window. There we establish the Child & Parent window setup for data piping…

Interactions:

  • Client Script (Script 1) Calling the Suitelet (Script 2) popup:
window.open(suiteletURL, "New Window Title", params);
  • In the Suitelet POST Action it’s UI controlled by another Client Scrip (Script 3) from that client script form gets the value. To route the value from Script 3 to script 1
var str = "<script>window.opener.require( [ '"+_FORM_CLIENT_SCRIPT_PATH+"' ], function ( cs ) { cs.setSlLine( '" + submitAction + "' ); } ); window.opener.focus(); window.close() </script>";
context.response.write( str );

where, setSlLine() is the function in Client Script ( Script 1), Inside that function the code written to set the the value in transaction record.

Leave a comment

Your email address will not be published. Required fields are marked *