cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ali_Nawaz
Helper III
Helper III

Odata Cast function not working in power automate

Hi PowerUsers,

I am using Cast function in PowerAutomate.

I was trying to read data from an D365 Human Resource entity though Odata endpoint and used Cast function as the field was of Yes/No (Enum) type.
Screenshot_1.png
The cast function was working absolutely fine a week ago but now it doesn't return any data all tough I have manually verified that the data exists.
Screenshot_2.png

10 REPLIES 10
abm
Super User III
Super User III

Hi @Ali_Nawaz 

 

Is your field 'IsPrimaryPosition' is a two option set?

 

image.png

 

If it is try without the cast

 

IsPrimaryPosition eq 1 

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

@abmYes it is an option set, stored as integers on back-end and displayed as string on front-end.

And Yes I have tried passing it as integer and string as well but it doesn't work.
Here's a screenshot of passing  it as integer.

Screenshot_1.png

abm
Super User III
Super User III

Hi,

 

Try without the singlequotes around worknumber.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

The "PersonnelNumber" is a text field.
Its not working without the single quotes around it.
Plus, the issue is with the cast function and "IsPrimaryPosition" column not with "PersonnelNumber" column.

abm
Super User III
Super User III

Hi @Ali_Nawaz 

 

Try to do the following:

 

Remove the second condition. Run the flow. Check the run history values and see what values are returned for two options set field. If you could post a screenshot that will be helpful.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
abm
Super User III
Super User III

Hi @Ali_Nawaz 

 

I did tested this.  I have created two fields similar like yours one string and another Yes/No optionset.

 

image.png

 

Following WEB API I tried 

 

https://xxxxxx.crm11.dynamics.com/api/data/v9.0/ajb_sports?$filter=ajb_personnelnumber eq '100' and ajb_isprimaryposition eq true

 

My results are as follows:

image.png

 

So in your case you don't need any cast to convert Yes/No. Also make sure there are no quotes around true.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
abm
Super User III
Super User III

Hi @Ali_Nawaz 

 

If you need any further help in this please let me know. If everything is working as expected then please mark it as solution accepted.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

@abmThe proposed solution does not work.
Please see the screenshot
Screenshot_1.png

abm
Super User III
Super User III

Hi @Ali_Nawaz 

 

I can see there is a JavaScript in your screenshot? Could you please explain?



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
abm
Super User III
Super User III

Hi @Ali_Nawaz 

 

Thanks for the discussion. So found out that this post ODATA is in question related to Dynamics Human Resource not Dynamics CE. Unfortunately I don't have the knowledge to provide any help on this. Hopefully Microsoft support could answer this.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (46,559)