Tim Roberson
04/10/2025, 6:47 PMCeligo AI
04/10/2025, 6:47 PMAI generated answer (using internal Slack threads):To use
record.type
as a script parameter in SuiteScript, you can access it from the record object that is passed into your script context. This can be useful when you want the same script to behave slightly differently depending on the type of record that triggered it.
Here's an example of how you might use record.type
in a script:
javascript
function afterSubmit(context) {
var record = context.newRecord;
var recordType = record.type;
if (recordType === 'salesorder') {
// Do something for sales orders
} else if (recordType === 'purchaseorder') {
// Do something for purchase orders
}
}
In this example, the afterSubmit
function is triggered after a record is submitted. The context.newRecord
object contains the new state of the record that was just submitted. The record.type
property gives you the type of the record.
If you want to set a script parameter with code rather than the UI, you can use the record.submitFields
method. However, this is undocumented and may break at any time. Here's an example:
javascript
record.submitFields({
id: deploymentInternalId,
type: record.Type.SCRIPT_DEPLOYMENT,
values: {
"custscript_interco_je_last_run_date": format.format({type: format.Type.DATETIME, value: runDate.toDate()}),
},
})
In this example, the record.submitFields
method is used to set a script parameter (custscript_interco_je_last_run_date
) to the last run date of the script.
Alternatively, you could use custom records or the runtime.getCurrentSession
method to store and retrieve dynamic parameters for your script.
******
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
04/10/2025, 6:47 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82169193
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816499472
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813743412
Celigo AI
04/10/2025, 6:47 PM