Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Deploy CRM Analytics Dashboard - Invalid JSON Format #2803

Closed
hmandsager opened this issue Apr 5, 2024 · 9 comments
Closed

Unable to Deploy CRM Analytics Dashboard - Invalid JSON Format #2803

hmandsager opened this issue Apr 5, 2024 · 9 comments
Labels
bug Issue or pull request that identifies or fixes a bug more information required Issue requires more information or a response from the customer validated Version information for this issue has been validated

Comments

@hmandsager
Copy link

Summary

I created an analytics template in VSCode and successfully deployed to a scratch org. I then created a sample dashboard within Analytics Studio, copied the JSON file from Analytics studio, created a new file in the and pointed template-info.json to this new dashboard. Attempting to push using either the CLI or VSCode failed with the same error.

Unable to load definition [waveTemplates/test/dashboards/mainDashboard.json] due to a parse/format error. The provided value is improperly formatted. Error: Invalid Json Format: Location[line -1:column -1] - Unrecognized field [label] in type [AssetReferenceInputRepresentation], not marked as ignorable (1:1)

I believe it has something to do with the steps object inside of the state object of mainDashboard.json. Specifically, if I go through the datasets object and remove label the error changes to point towards url as an unrecognized field. Going through the documentation it appears that Analytics Studio produced a file where datasets is a AssetReferenceRepresentation while the CLI seems to think it should be of type AssetReferenceInputRepresentation

Steps To Reproduce

Here is a .zip of the example repo: analytics-test.zip

  1. Unzip file and connect to your SF developer edition org.
  2. Run sf project deploy start or SFDX: Push Source to Default Org through VSCode
  3. Validate that testDashboard successfully deploys by updating template-info.json to below:
  "dashboards": [
    {
      "label": "testDashboard",
      "name": "testDashboard_tp",
      "condition": "${Variables.Overrides.createAllDashboards}",
      "file": "dashboards/testDashboard.json"
    }

Expected result

Successfully deploys template to the scratch org

Actual result

Unable to load definition [waveTemplates/test/dashboards/mainDashboard.json] due to a parse/format error. The provided value is improperly formatted. Error: Invalid Json Format: Location[line -1:column -1] - Unrecognized field [label] in type [AssetReferenceInputRepresentation], not marked as ignorable (1:1)

System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.35.6",
  "nodeVersion": "node-v20.11.1",
  "osVersion": "Darwin 23.2.0",
  "rootPath": "/Users/hmandsager/.local/share/sf/client/2.35.6-3a4a215",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.13 (core)",
    "@oclif/plugin-commands 3.2.2 (core)",
    "@oclif/plugin-help 6.0.20 (core)",
    "@oclif/plugin-not-found 3.1.1 (core)",
    "@oclif/plugin-plugins 5.0.1 (core)",
    "@oclif/plugin-search 1.0.20 (core)",
    "@oclif/plugin-update 4.2.2 (core)",
    "@oclif/plugin-version 2.0.16 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.15 (core)",
    "@oclif/plugin-which 3.1.7 (core)",
    "@salesforce/cli 2.35.6 (core)",
    "apex 3.1.0 (core)",
    "auth 3.5.0 (core)",
    "data 3.2.2 (core)",
    "deploy-retrieve 3.4.0 (core)",
    "env 3.0.25 (user)",
    "functions 1.23.0 (user)",
    "info 3.1.0 (core)",
    "limits 3.2.0 (core)",
    "marketplace 1.1.0 (core)",
    "org 3.6.0 (core)",
    "packaging 2.2.0 (core)",
    "schema 3.2.0 (core)",
    "settings 2.1.0 (core)",
    "signups 2.1.0 (user)",
    "sobject 1.2.0 (core)",
    "source 3.2.0 (core)",
    "telemetry 3.1.17 (core)",
    "templates 56.1.0 (core)",
    "trust 3.4.0 (core)",
    "user 3.4.0 (core)"
  ]
}

Additional information

@hmandsager hmandsager added the investigating We're actively investigating this issue label Apr 5, 2024
Copy link

github-actions bot commented Apr 5, 2024

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Apr 5, 2024
@WillieRuemmele
Copy link
Member

Thanks for providing the zip, that's super helpful. I was able to create a new org, and run sf project deploy start and saw the same error

@WillieRuemmele WillieRuemmele added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Apr 5, 2024
@WillieRuemmele
Copy link
Member

hey @hmandsager can I ask how you created the mainDashboard.json? If I change your project to use and deploy the testDashboard it works, I'm wondering if there's something wrong with your local file that's causing the server to interpret it as that wrong metadata type

@WillieRuemmele WillieRuemmele added the more information required Issue requires more information or a response from the customer label Apr 5, 2024
@hmandsager
Copy link
Author

I copy and pasted the JSON from an Analytics Studio dashboard. I tried:

  1. Outright copying the JSON which failed
  2. Taking the testDashboard.json as a base and incrementally adding objects from Main Dashboard. That's how I determined the steps object was the cause of the error.

I've attached the JSON from analytics studio
analytics_studio_dashboard.json

@WillieRuemmele
Copy link
Member

I'm wondering if one of those incremental additions has transformed it. From the CLI's perspective, everything is getting built and deployed to the server correctly. Is there any way to create these dashboards in the org and then project retrieve them?

@hmandsager
Copy link
Author

Even just copying and pasting the the json in its entirety causes the error...incremental was to just try and drill down to which part seemed to be the issue. Using sf project retrieve start brought down the dashboard as a .wlens file so a unsure if that's the same. Not finding a ton of documentation on best practices here but assumed I could copy the JSON between Analytics Studio and an app template.

@WillieRuemmele
Copy link
Member

the file's suffix plays an important role, even if it's a json structure keeping the same suffix will be required when retrieving/deploying

@hmandsager
Copy link
Author

I was able to create a template from an app and run sf project retrieve which looked correct. Still odd that the dashboard JSON can't be copied but maybe that is expected.

@WillieRuemmele
Copy link
Member

sounds like you've solved the issue then? I'll close this issue, but if you're still seeing errors, we can reopen :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug more information required Issue requires more information or a response from the customer validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants