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

GUID as alternate key value #66

Closed
m-szyszka opened this issue Mar 30, 2020 · 5 comments
Closed

GUID as alternate key value #66

m-szyszka opened this issue Mar 30, 2020 · 5 comments
Assignees
Labels

Comments

@m-szyszka
Copy link

m-szyszka commented Mar 30, 2020

I'm tryin to update single value (or whole record) using Alternate Key.
When I'm using

keyName='xxx'

it's giving me message

Error: A record with the specified key values does not exist in 

which is OK,
but when key value is a UUID and exists in CDS, library says

<entity_name> With Id = 44771e9d-b5ea-4b86-92d3-72be52d6b807 Does Not Exist

Looks like UUID in Alternate Key value is recognized and processed as Primary Key.
Result: can;t update entity using Alternate Key with UUID value.

@AleksandrRogov
Copy link
Owner

AleksandrRogov commented Mar 30, 2020

hi @m-szyszka.
I will try to reproduce it. It would be great if you had a code example of what you are doing, so I could provide you with a workaround for your case, but you can simply use the UUID value without providing the key name for the primary key.

let toUpdate = { name: "update this lead" };
let primaryKey = "44771e9d-b5ea-4b86-92d3-72be52d6b807";
//update with a primary key:
let result = await dynamicsWebApi.update(primaryKey, "leads", toUpdate);

@AleksandrRogov
Copy link
Owner

I think I misunderstood your issue. You don't want that UUID to be recognized as a primary key.
Ok, I'll take a look at that.

@m-szyszka
Copy link
Author

I want to use UUID as Alternate Key value, and it's not working for me. When Alternate Key value is a normal string, it's working.
Part of my code:

const keyValuePair = { my_status: status };
    const key = `my_reference='${myReference}'`;
    logger.info(`Trying to update  entity ${myReference} status to ${status}`);
    return dynamicsWebApi.updateSingleProperty(key, ENTITY_COLLECTION_NAME,
      keyValuePair, ['return=representation'])

When "myReference" is an UUID, it's not working.

@AleksandrRogov
Copy link
Owner

@m-szyszka please download a new patch 1.6.3 and let me know if it fixes your issue!
Thank you for submitting the issue!

@m-szyszka
Copy link
Author

It's working now, thanks for fast response

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