cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jzcase
Level 8

Passing dropdown selection to Flow (need primaryID, can't get it).

I'm learning how to use the CDS connector instead of the Dynamics 365 connector in PowerApps Studio, and I've hit a problem with passing an Option Set selection from a Canvas App form to Flow.

 

In Studio, the CDS connector wants to hide all PrimaryIDs, which is fine when I'm submitting a form directly back into CDS.

 

But sometimes I want to pass my form data to Flow instead. When I pass DataCardValue1.Selected.Value, it sends the text string of the option, not the PrimaryID.

 

This is a problem for Flow, because when I try to use Flow to create a record in CDS, guess what? Flow wants the PrimaryID, not the text string. So Flow throws an error: Microsoft.OData.ODataException: Cannot convert the literal 'Classroom - Resource' to the expected type 'Edm.Int32'. ---> System.FormatException: Input string was not in a correct format.

 

So can someone help me do either of the following:

  • In PowerApps, is there a way for me to get the PrimaryID of the user selection from the CDS Option Set, so that I can pass it to Flow?
  • In Flow, is there a way for me to use the text string of the user answer to get the PrimaryID for that Option Set answer to help me create the record in CDS using Flow?
1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Passing dropdown selection to Flow (need primaryID, can't get it).

Hi @jzcase 

 

You can achieve this by following below steps:
 
1) Create a collection based on the value in the option set, you can get these values from:
 
MicrosoftTeams-image (11).png
 
This will be done on the button to trigger the flow.
 
2) Make changes to flow as:
 
MicrosoftTeams-image (12).png
Expression: int(variables('testvar'))
 
3) Button OnSelect: ClearCollect(OptionSetValues,{Name:"Money",Value:"0"},{Name:"Decimal",Value:"1"},{Name:"Integer",Value:"2"});OptionSetTest.Run(LookUp(OptionSetValues,Name = Text(DataCardValue3.Selected.Value)).Value)
 
Here, OptionSetTest is the name of flow.
 
Note: After making the changes in flow, re-register it so that powerapps point to latest version of the flow.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: Passing dropdown selection to Flow (need primaryID, can't get it).

Hi @jzcase 

 

You can achieve this by following below steps:
 
1) Create a collection based on the value in the option set, you can get these values from:
 
MicrosoftTeams-image (11).png
 
This will be done on the button to trigger the flow.
 
2) Make changes to flow as:
 
MicrosoftTeams-image (12).png
Expression: int(variables('testvar'))
 
3) Button OnSelect: ClearCollect(OptionSetValues,{Name:"Money",Value:"0"},{Name:"Decimal",Value:"1"},{Name:"Integer",Value:"2"});OptionSetTest.Run(LookUp(OptionSetValues,Name = Text(DataCardValue3.Selected.Value)).Value)
 
Here, OptionSetTest is the name of flow.
 
Note: After making the changes in flow, re-register it so that powerapps point to latest version of the flow.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Community Support Team
Community Support Team

Re: Passing dropdown selection to Flow (need primaryID, can't get it).

Hi @jzcase ,

Do you want to get the PrimaryID value of a Option Set option within your app?

Do you want to pass the PrimaryID value of a Option Set option from your app to your flow?

 

Based on the needs that you mentioned, I afraid that there is no way to achieve your needs in PowerApps currently.

 

As an alternative solution, I agree with @yashag2255 's thought almsot. When you defined a Option Set type in your CDS, the CDS System would generate PrimaryID/Value for each item option as below:5.JPG

On your side, you could consider create a collection in your app based on the Option Set Item value and corresponding PrimaryID value as below (set the OnStart property of the App control to following:😞

ClearCollect(
                   ApprovalStatusOptionSetColelction,
                   {Name: "Pending", Value: 886370000}
                   {Name: "Approve", Value: 886370001},
                   {Name: "Reject", Value: 886370002}
)

Then within your app, you could pass the PrimaryID value of the corresponding Option Set option to your flow using the following formula:

'FlowName'.Run(LookUp(ApprovalStatusOptionSetColelction, Name = OptionSetComboBox.Selected.Value, Value))

Then within your flow, please configure it as below:6.JPG

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SteveTGC
Level: Powered On

Re: Passing dropdown selection to Flow (need primaryID, can't get it).

I though the new way to do this was using CDS option set and opton set dropdowns populated via Choices.

 

i.e. DropDown1 items: Choices('Type (Identity Checks)')   //Where 'Type (Identity Checks)' is an options set on my entity

 

Using patch works: 

Either using the option set directly 
Patch('Identity Checks', Defaults('Identity Checks'),
{'Originating Case': SelectedCase},
{Type: [@'Type (Identity Checks)'].Setup}
);
Or using the Drop Down
Patch('Identity Checks', Defaults('Identity Checks'),
{'Originating Case': SelectedCase},
{Type: Dropdown1.Selected.Value}
)

 

But when using Flow CDS does not intepret the Value correctly: 

 

Set(TestingID, GrowerCC_CreateNewIDCheck.Run(

Dropdown1.Selected.Value,
SelectedContact.Contact,
SelectedCase.Case,
SelectedNGR.Account).identitycheckid)

 

Annotation 2019-08-22 012534.jpg

 

 

 

Or if using the new notation....same deal with:

Set(TestingID, GrowerCC_CreateNewIDCheck.Run(
'Type (Identity Checks)'.Setup,
SelectedContact.Contact,
SelectedCase.Case,
SelectedNGR.Account).identitycheckid);

jzcase
Level 8

Re: Passing dropdown selection to Flow (need primaryID, can't get it).

Yeah, this and Kris Dai's responses are the way to go.

 

I mean, kind of stinks that I need to manually tell PowerApps information that it should already be able to access. This issue and the problem with LookUp fields (link) show that the CDS 2.0 connector really needs work.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Users Online
Currently online: 402 members 5,917 guests
Please welcome our newest community members: