In previous posts, we showed you how to install the SDF CLI (Command Line Interface) and how to deploy scripts to NetSuite using SDF. But did you know that you can use SDF to pull down your script record object from Sandbox and push it up to Production in just a few easy steps? Follow along as we learn how to use SDF to deploy Sandbox script to Production.
Pull Down the Script Object from Sandbox
First, after navigating to the correct folder in your terminal, run suitecloud object:import -i
. The SuiteCloud CLI will respond with the following questions. I’ve included some answers we would recommend.
? Do you want to import all object types: Yes
? Do you want to enter a script ID to filter your list? Yes
? Enter the full or partial script ID. [your script's ID ('customscript...')]
? Select the objects you want to import [find your script in the list]
? Do you want to import the SuiteScript files referenced in the objects?
[Select "No" if you already have those SuiteScript files on your computer.
If you want to import those files and overwrite anything that you might already have, select "Yes."]
? Select the folder where you want to import the objects. /Objects
? All the selected objects in the project will be overwritten with the objects from the account.
Do you want to continue? Yes
Now take a look at the new XML file inside your Objects folder. Notice some of the tags, such as <clientscript scriptid="">
, <status>
, <name>
, <recordtype>
, and <loglevel>.
It’s all there—all the instructions for how to deploy your script. This object contains all the data for both the script record and the script deployment record. Consequently, all you need to do is deploy the project.
Please note the <status>
tag in this XML file. If set to “RELEASED” the script will be released for everyone when we deploy to Production. You probably want the script to be in Testing mode, however, when you first deploy. Therefore, make sure you change the <status>
tag to “TESTING” to mitigate any potential issues.
Switch to Production
Second, run suitecloud account:setup
in your terminal to switch to Production. This command gives a list of “authenticated configuration IDs.” Then select your Production ID. This step assumes you’ve set up a production ID. If you need to set up your Production account ID, you can select the “Create a new authentication ID” option. (You can read more about creating authIDs here.)
Deploy Sandbox Script to Production
Finally, you can run suitecloud project:deploy
. This will deploy your entire project to Production, including the XML details for the script record and deployment record. All the steps necessary for deployment (e.g., creating your script record, creating the correct deployment record with the correct ID) will be taken care of automatically.
Test and Release
After testing the new script in Production, you can change the status from “Testing” to “Released” in the User Interface. You may also change the inner text of the <status>
tag to “Released” in the XML file before you run suitecloud project:deploy
. Be cautious of this, however, since your script will be released for everyone to use.
Conclusion
At SuiteRep, we’re always seeking to streamline our processes. And maximizing our use of SDF is one way to do that. We hope this tip makes your dev life more productive. If you found this article helpful, please subscribe to our email list to stay up to date with our latest blog posts.