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

commercetools - can't save multiple values #111

Closed
GurpreetSran opened this issue Jul 28, 2020 · 3 comments
Closed

commercetools - can't save multiple values #111

GurpreetSran opened this issue Jul 28, 2020 · 3 comments

Comments

@GurpreetSran
Copy link

I'm trying to save multiple (Array fields) entries to contentful but request is failing. Seems like only Symbol field type is supported according to this code.

function isCompatibleField(field: Field): boolean {

Below is the failed response:

`{
  "sys": {
    "type": "Error",
    "id": "InvalidEntry"
  },
  "message": "Validation error",
  "details": {
    "errors": [
      {
        "name": "type",
        "value": [
          "FG018004",
          "FG035001",
          "FG005012"
        ],
        "type": "Symbol",
        "details": "The type of \"value\" is incorrect, expected type: Symbol",
        "path": [
          "fields",
          "FlBFCOln67hlX5Zk",
          "en-US",
          0
        ]
      }
    ]
  },
  "requestId": "5146b11619ecc4b2ba5fdb974b5397cc"
}
@GurpreetSran
Copy link
Author

GurpreetSran commented Jul 28, 2020

It's bit confusing actually. The Array type field is being filtered out with rest, except Symbol as I pointed out above. On other hand, there are checks against Array such as:

   if (skus.length > 0) {
      const value = this.props.sdk.field.type === 'Array' ? skus : skus[0];
      this.props.sdk.field.setValue(value);
    } else {
      this.props.sdk.field.removeValue();
    }

@davidfateh
Copy link
Contributor

Hi @GurpreetSran ,

It is not clear to me whether this is a problem with the code itself or maybe a configuration of the space you're working in. I'd ask that you submit a ticket with our support team so we can further assist you in this matter.

@GurpreetSran
Copy link
Author

GurpreetSran commented Jul 31, 2020

Thanks @davidfateh, I have found an alternative approach to achieve this. I'll contact the support team if any further assistance needed. Closing this now if this code is not good enough in order to pin point the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants