Mike Casey
08/01/2025, 5:40 PMCeligo AI
08/01/2025, 5:40 PMAI generated answer (using internal Slack threads):In NetSuite, the form has already been chosen by the time of the
beforeLoad user event script. Therefore, you cannot directly set the custom form in a beforeLoad script. However, there are a few workarounds you can consider:
1. Redirect the user: You can use the N/redirect module to redirect the user to the desired form. You should be able to add a cf parameter in the URL for the custom form.
javascript
var redirect = require('N/redirect');
redirect.toRecord({
type : record.Type.SALES_ORDER,
id : 1234,
parameters : {cf : 12} // 12 is the internal id of the custom form
});
2. Use a beforeSubmit user event script: If you need to set the custom form when the transaction is created by other scripts, you can use a beforeSubmit user event script. However, this will not change the form that the user sees during the initial creation of the record.
3. Set customform with the defaultvalues option in `record.create()`: If you control the other scripts creating the transaction, you can set the customform field with the defaultvalues option in record.create(). This will set the custom form when the record is initially created.
javascript
var record = record.create({
type: record.Type.SALES_ORDER,
defaultValues: {
customform: 12 // 12 is the internal id of the custom form
}
});
Remember, these are workarounds and may not be suitable for all use cases. Always test thoroughly to ensure the desired behavior is achieved.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/01/2025, 5:41 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.892916
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.866242766
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.862782061
Celigo AI
08/01/2025, 5:41 PM