Skip to main content
SFDC Developers
DevOps

Data 360 2GP Managed Package: A Technical DevOps Guide

Vinay Vernekar · · 5 min read

Introduction to Data 360 Packaging

In the modern Salesforce ecosystem, architecting a Data 360 solution—where unified customer views are paramount—often requires building modular, extensible applications. The Second Generation Managed Package (2GP) architecture is the standard for delivering these features. However, as developers, we often run into specific API behaviors when flags for Data 360 functionality are required at the package version level. In this guide, we’ll demystify the process of configuring your 2GP, focusing on the critical nuances of the Tooling API and package creation lifecycle.

The Architecture of 2GP and Data 360 Flags

When we talk about 'Data 360' capabilities within a managed package, we are often referencing specific platform entitlements that must be signaled during the package version creation process. A common pitfall for architects is assuming these flags are defined at the initial Package object level.

As discovered through technical exploration, the flag that dictates whether a package is a 'Data 360' capable package is not set on the package container itself, but rather on the Package Version creation.

Why the Confusion?

Many developers assume the Package object (created via sfdx force:package:create) should hold these metadata flags. However, the Tooling API treats these flags as transient state properties that apply to the binary artifact. If you look at the documentation, the field appears to be 'createable', but in practice, the system validates this setting only when the first package version is generated.

Step-by-Step Configuration Strategy

To ensure your package is correctly configured, you must move away from manual UI-based package creation and adopt a command-line-driven approach using Salesforce CLI. This ensures your CI/CD pipeline remains idempotent and predictable.

1. Preparing the sfdx-project.json

Before you trigger the creation, ensure your sfdx-project.json is properly structured. While the Data 360 flag isn't defined here, your dependencies and package aliases must be pristine.

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true,
      "package": "Data360Package",
      "versionName": "v1.0.0",
      "versionNumber": "1.0.0.NEXT"
    }
  ],
  "namespace": "my-namespace",
  "sfdcLoginUrl": "https://login.salesforce.com"
}

2. Leveraging the Tooling API for Version Creation

When you are ready to create the version, you are implicitly making a call to the Tooling API. Because the Data 360 flag defaults to false (rather than null), you must ensure your build script explicitly handles the flag state.

If you use the Salesforce CLI, use the --json output to capture the result of the version creation request to verify that the flag was registered:

sfdx force:package:version:create --package Data360Package --installation-key-bypass --wait 20 --json

Debugging the Package Creation Lifecycle

If your package fails to register for Data 360 services, it is almost always due to a race condition or a misunderstanding of when the field is read. Since the field is only evaluated at the point of the first package version creation, you cannot 'fix' a package version that was created with the wrong flag. You must increment the version and initiate a new request.

The 'Null vs. False' Trap

  • The Null State: Indicates the system has not yet processed a version creation for this package container.
  • The False State: Indicates the package has been initialized without the Data 360 flag.
  • The True State: Must be explicitly set during the version generation command.

When writing your deployment scripts (e.g., using GitHub Actions or Jenkins), ensure that your environment variables explicitly define the flags required for your Data 360 features.

// Example of how we might validate package status in a custom CLI plugin
const query = "SELECT Id, IsData360Enabled FROM Package2Version WHERE Package2Id = '0Ho...' LIMIT 1";
const result = await connection.tooling.query(query);
if (result.records[0].IsData360Enabled === false) {
  console.error("Package version created without Data 360 flag. Reverting...");
}

Best Practices for DevOps Teams

  1. Version Control Everything: Keep your sfdx-project.json and build scripts in the same repo as your metadata. Never manually click 'Create Package' in the Org.
  2. Automated Validation: Build a step in your pipeline that queries the Package2Version object to confirm that the flags were set correctly before proceeding to your scratch org integration tests.
  3. Handle Dependencies: If your Data 360 package relies on other managed packages, ensure they are listed in your dependencies section in the sfdx-project.json to prevent resolution errors during the package version build process.

Key Takeaways

  • Flag placement: The Data 360 flag is a property of the Package Version, not the Package container.
  • Immutability: Once a package version is created with the wrong flag, it cannot be edited. You must create a new version.
  • Tooling API: Rely on the Tooling API for visibility. Querying the Package2Version object is the only reliable way to audit your packaging configuration post-build.
  • Automation: Use the SFDX CLI exclusively to maintain consistency across your DevOps pipelines, avoiding UI-based errors.
  • Defaults: Understand that the system defaults to false. If you miss the flag setting, your package will silently lack the required Data 360 entitlements.

Share this article

Get weekly Salesforce dev tutorials in your inbox

Comments

Loading comments...

Leave a Comment

Trending Now