AleksandrRogov / DynamicsWebApi

DynamicsWebApi is a Microsoft Dataverse Web API helper library for JavaScript & TypeScript
MIT License
268 stars 58 forks source link

Issue with unbound function parameters #149

Closed dantol1 closed 1 year ago

dantol1 commented 1 year ago

Hi, I was trying to make an unbound function call and add a guid parameter, but I kept receiving and error "Expression of type 'Edm.String' cannot be converted to type 'Edm.Guid'." I looked at the code and it looks like the buildFunctionParameters wraps the parameter in '' which is the cause of this issue, is there a way to avoid it being added? or should I open a PR with a purposed fix?

Possible problematic code for reference: https://github.com/AleksandrRogov/DynamicsWebApi/blob/4606f710dfaf8c938e04e32085526de392bcef12/lib/utilities/buildFunctionParameters.js#L21

the function I want to use is: RetrieveAadUserRoles

dantol1 commented 1 year ago

Verified with another function that guid shouldn't be wrapped in ''

additional function that fails with guid: RetrieveAadUserSetOfPrivilegesByNames

so a fix should be fairly simple (make sure it's not a guid before wrapping with '') unless there is already a solution that I missed.

AleksandrRogov commented 1 year ago

hi @dantol1 , yes, you are right, this is a bug. and yes, the solution should be fairly straight forward. I already have a similar check for alternate keys and I will apply the same one to the function parameters.

AleksandrRogov commented 1 year ago

hi @dantol1 ,

Published a patch v.1.7.9. It should be live on NPM. Let me know if you have any further issues with it.

P.S. Forgot to thank you for reporting it. Thank you!

dantol1 commented 1 year ago

Amazing it works perfectly now! Thanks a lot!