Using suiteql, (or any other method) is there a wa...
# ask-stanley-ai
e
Using suiteql, (or any other method) is there a way to retrieve a script parameter value from a script deployment?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that you can retrieve a script parameter value from a script deployment using a combination of SuiteScript and SuiteQL. In SuiteScript, you can use the
N/record
module to load the deployment record and treat the parameter as a custom field. However, this method does not seem to provide the value of the parameter. In SuiteQL, you can use a query similar to
SELECT * FROM parametersScript WHERE owner=<scriptid>
. This will provide information about the custom fields, but not their values. A more comprehensive approach would be to use a combination of SuiteQL,
N/runtime
, and
N/record
. Here's a code snippet that was shared in the conversation:
Copy code
javascript
const runSuiteQL = (queryStr) => query.runSuiteQL({ query : queryStr }).asMappedResults();

const scriptParamRes = runSuiteQL(`SELECT s.id, s.scriptid, p.internalid, p.fieldtype, p.setting 
    FROM script s
    JOIN parametersScript p ON p.owner = s.id
WHERE p.setting = 'COMPANY'`)

const scriptParamValues = scriptParamRes.map(x => runtime.getCurrentScript().getParameter(x.internalid))
This code uses SuiteQL to get the script parameters, and then uses
N/runtime
to get the values of those parameters. However, this only retrieves the 'COMPANY' values. To get the values for a specific deployment, you can load the deployment as a record using
record.Type.SCRIPT_DEPLOYMENT
and then retrieve the information from that. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.876735
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.87097609
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859810889
Please provide your feedback on this answer.