In suitescript, both scriptContext.response.writePage and scriptContext.response.write are methods used to handle response to a client.
scriptContext.response.writePage:
- It is used to render and send a whole page or form.
- Ideally used for suitelets with interactive UI elements.
- Example: Used to create a custom form with input fields and buttons that users can interact with.
scriptContext.response.write:
- sends raw HTML, text, and data directly to the response.
- provides great flexibility for outputs that do not have any interactive UI elements.
- Example: Used to return a plain HTML page or JSON response