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 set JSON config for additionalInfo property #550

Closed
justin-nevitech opened this issue Aug 15, 2024 · 6 comments
Closed

Unable to set JSON config for additionalInfo property #550

justin-nevitech opened this issue Aug 15, 2024 · 6 comments
Labels
bug Something isn't working release/13.1.7

Comments

@justin-nevitech
Copy link

Describe the bug
I need to set some JSON in the config property to pass to a custom view for a property in the order editor config but it is not working. If I set this to a JSON value I get an error loading the config and if I set it to an encoded JSON string it errors when I try and edit the additional information section in the order (as it is expecting an object not a string).

Steps To Reproduce
Steps to reproduce the behavior:

  1. Add the following to a custom order editor config in the additionalInfo section:
{
  "alias": "shippingStatus",
  "label": "Shipping Status",
  "view": "/App_Plugins/SimpleDropdown/simpleDropdown.html",
  "config": {
    "items": [
      {
        "id": 0,
        "value": "Not Shipped"
      },
      {
        "id": 1,
        "value": "Shipped"
      }
    ]
  }
}
  1. Try and edit an order and the page will fail to load with the error:
Server error: Contact administrator, see log for full details.
Failed to get order editor config

The full error I get is:

{
    "ExceptionMessage": "Unexpected character encountered while parsing value: {. Path 'additionalInfo[2].config', line 97, position 17.",
    "ExceptionType": null,
    "StackTrace": null
}

Expected behavior
The custom property should load the editor config and pass the config to the view as JSON. I'm sure I had a working version of this with Vendr but that is going back a couple of years... I am following the instructions here but this doesn't specify what the JSON should look like:

https://docs.umbraco.com/umbraco-commerce/v/10.commerce.latest/key-concepts/ui-config-files#additional-info-config-options

Umbraco Commerce version:
13.1.6

@justin-nevitech justin-nevitech added the bug Something isn't working label Aug 15, 2024
@mattbrailsford
Copy link
Contributor

Hey @justin-nevitech from what endpoint is that exception being thrown?

@mattbrailsford
Copy link
Contributor

Actually, looking at the code, it is expected that config is a string, so this should be a JSON encoded value. I'm reluctant to change this as I'm not sure what issues that could cause if I make it something else.

I think what I could probably do though is when the property model is being created client side, if the config string looks like a json string, then I think we can deserialize it client side and send it to the property in the format it expects.

@mattbrailsford
Copy link
Contributor

Ok, so I've just pushed a 13.1.7--preview.1+fc04426 build to our nightly server if you want to give that a try. It still expects the config to be a string so you'll need to encode the json config value, but the front end should now attempt to parse it out.

You can find details here on how to use the nightly feed https://docs.umbraco.com/umbraco-cms/fundamentals/setup/install/installing-nightly-builds

@justin-nevitech
Copy link
Author

Thanks @mattbrailsford Will have a look next week, on holiday at the moment.

@justin-nevitech
Copy link
Author

Hi @mattbrailsford All works using the 13.1.7--preview.1+fc04426 nightly build and a JSON encoded config value, thanks!

@mattbrailsford
Copy link
Contributor

13.1.7 was released last week so I believe this should all be public now so will close down this issue. Many thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release/13.1.7
Projects
None yet
Development

No branches or pull requests

2 participants