Use Custom Scripts in Data 360
Create custom Python scripts for Data 360 batch transforms by using your local toolchain: Salesforce CLI, the Code Extension plugin, and the Data Custom Code Python SDK. Write and validate your scripts locally against a sandbox org, then deploy them to your sandbox. After testing in the sandbox, use a data kit to move your batch data transforms and code extensions to production for processing production data.
| Edition Table |
|---|
| Available in: Developer, Enterprise, Performance, and Unlimited Editions. See Data 360 edition availability. |
| Permission Sets Needed | |
|---|---|
| To use custom scripts in Data 360: | Permission set:
|
-
Make sure that you have access to a Data 360 org with appropriate permission sets.
-
Make sure that you have access to a Data 360 sandbox with appropriate permission sets. If you don’t have a sandbox, create one. See Create a Data 360 Sandbox.
- Go to Data Cloud Setup.
- Under Feature Management, click Feature Manager.
- To enable Code Extension, click Enable next to Code Extension.
- Agree to the terms and service, and then confirm that you want to enable it.
After you enable the feature, the Code Extension tab appears in the UI. See Enable Data 360 Features in Feature Manager.
Confirm that your Data 360 sandbox contains the data model objects (DMOs) and the data lake objects (DLOs) that your custom scripts reference.
Your script must read from and write to the same object type: DLOs to DLOs and DMOs to DMOs. Custom scripts read from your source data objects and write transformed results to different data objects, preserving your original data.
You must manually assign and audit appropriate governance tags on target DLOs or DMOs that your code extension scripts create or update. This ensures compliance with your organization’s governance data policies. Automatic tag propagation for target objects will be supported soon.
Salesforce CLI with the Code Extension plugin and the Data Custom Code Python SDK work together as your local toolchain for Code Extension. This setup helps you develop and test custom Python scripts locally, and then deploy them to Data 360 for execution. See Set Up Salesforce CLI for Code Extension.
Write and test your custom transform logic in your preferred local development environment, and validate it locally against a sandbox org by using Salesforce CLI. This iterative process helps you catch issues early and refine your logic for production readiness. See Write and Validate Custom Scripts.
All code execution logs are written to a dedicated Logs DLO (DataCustomCodeLogs__dll) for observability and troubleshooting. Data governance policies don’t apply to the Logs DLO, and any user with access to the Logs DLO can view its contents. To prevent inadvertent exposure of sensitive information, ensure that your code extension scripts output only the information that is appropriate for users with access to the Logs DLO to see. Don’t output PII, credentials, or other sensitive data to standard output (for example, Python print() statements or console logging).
The deployment process packages your Python script, its dependencies, and Data 360 configuration, and then uploads them to Data 360. See Deploy a Custom Script to Data 360 Sandbox Using UI.
Monitor your deployment to verify that it’s successful, and your custom script is ready for use. See Monitor Deployment Details.
Invoke your code extension by creating a batch data transform that uses your deployed custom script. See Invoke Code Extension by Creating a Batch Data Transform.
Run your code extension by running the batch data transform that uses your deployed custom script. See Run Code Extension by Running a Batch Data Transform.
Monitor your custom script’s execution, review logs, and validate the output in the sandbox to verify that your script transforms the data as expected. If you find issues, return to Step 4 to modify and redeploy your script. See Run History.
Create a DevOps data kit in your sandbox, add your batch data transform after validation in the sandbox, and include any referenced DLOs or DMOs that don’t exist in production. When you add a batch data transform, the code extension it references is automatically included. Alternatively, you can add code extensions directly to the data kit and create batch data transforms in production later to associate with the code extension. Review the publishing sequence, publish the data kit, add it to a package, and then deploy to production. See Migrate Custom Script Data to Production.
If you migrated a batch data transform, run your code extension in production by running the batch data transform, and monitor execution to verify that your custom transform works correctly. If you migrated only a code extension without a batch transform, first invoke the migrated code extension by creating a batch data transform that uses it, and then run the batch data transform. See Invoke Code Extension by Creating a Batch Data Transform, Run Code Extension by Running a Batch Data Transform, and Run History.