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

Parse response error #13

Closed
estpla opened this issue Oct 29, 2017 · 1 comment
Closed

Parse response error #13

estpla opened this issue Oct 29, 2017 · 1 comment
Assignees
Labels

Comments

@estpla
Copy link

estpla commented Oct 29, 2017

Hi,

I get an JS error when I try the next code:

dynamicsWebApi.retrieveAll("accounts", ["name", "emailaddress1"]).then(function (response) {
    var records = response.value;
    console.log(records);
})
.catch(function (error) {
});
\dynamics-web-api\lib\requests\helpers\parseResponse.js:33
        if (object[keys[i]].constructor === Array) {

TypeError: Cannot read property 'constructor' of null

As a workaround I have changed line 33 of parseResponse.js, from:

if (object[keys[i]].constructor === Array) {

To:

if (object[keys[i]] != null && object[keys[i]].constructor === Array) {

Hope it helps!

PD: Seems that the error comes because there are accounts without email and calling ".constructor" of if.

@AleksandrRogov
Copy link
Owner

Thank you so much @estpla. I will apply your fix in the next patch release!

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

No branches or pull requests

2 participants