cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arichards
Advocate III
Advocate III

Powerapps: If combo Box 1 is equal to A then combo box 2 is set to A and disabled otherwise user cho

Powerapps is linked to a SharePoint Online list

 

Combo box 1:  Asset Type (2 options): IT Asset, Non IT Asset

 

If this box is set to "IT Asset" I need it to:

Combo Box 2: 1st level Approver ( 9 options): IT Director, Manager, Local Controller, General Manager, Field Controller, Regional Controller, CFO, CEO, BoD: This needs to be set to first option (IT Director) and gray out (disable)

Combo Box3: Approval (Person Field from SharePoint); Set to name of IT director and gray out (disable)

 

 

Any and all assistance to accomplish this would be helpful!

 

Thanks,

Amanda

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@rebeccas

 

I finally got this working:

 

Combo box 1: Set OnSelect to: Set(varAssetType,ComboBox1.Selected.Value)

 

Combo box 2: Set DefaultSelectedItems to: f(ComboBox1.Selected.Value ="IT Asset",(Filter(Choices(ListName.ComboBox2),Value="IT Director")))

 

Combo box 3: Set DefaultSelectedItems to: If(ComboBox1.Selected.Value ="IT Asset",
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:Concatenate("i:0#.f|membership|","JohnDoe@domain.com"),
DisplayName:Office365Users.UserProfileV2("JohnDoe@domain.com").displayName,
Email:"JohnDoe@domain.com" },Parent.Default)

 

Then on the DisplayMode of both the data cards for Combo Box 2 and Combo Box 3 to: If(ComboBox1.Selected.Value ="IT Asset",Disabled,Edit)

 

Hopefully this can help someone else!

View solution in original post

16 REPLIES 16
rebeccas
Super User
Super User

You would just use an If statement for this...

 

So..if you want it to default the value on Combo Box 2 off Combo Box 1 then the Default Value for Combox box 2 would be = If(ComboBox1.Selected.Value="IT Asset","IT Director") -- this will say if they select IT Asset for ComboBox1 then make the Default for Combo Box 2 "IT Director"

 

You would do the same If statement with a variation for making it disabled...

 

If(ComboBox1.Selected.Value="IT Asset",Disabled, Edit) -- This would go on the DisplayMode for ComboBox 2

 

Just make sure to remember that when you put a default for a combo box it goes on the DefaultSelectedItems....not the regular Default

 

 

AlexKeil
Advocate II
Advocate II

This video might help. These guys are pretty good with PowerApps.

 

https://www.youtube.com/watch?v=pkZG2boN7jQ 

@rebeccas I would like this as a solution but your default formula is not working "The property expects Record values but this rule produces incompatible text values."  there is no else part of this statement.

 

If(ComboBox1.Selected.Value= "IT Asset","IT Director") if it is false I would like it to be blank but I cannot seem to get it in the formula. 

 

Any thoughts?

@arichards

 

Okay, sorry...it is because I told you wrong it isn't working...I had to go pull up one of my old ones to get it right...thought I could right off...but I was wrong.

 

Anyhow, try:

 

If(ComboBox1.Selected.Value="IT Asset", (Filter(Choices(SPListName.Column2Name),Value="IT Director")))

 

You don't have to tell it anything special to make it blank if not...it will be. Let me know if this doesn't work for you. 

 

Rebecca

 

 

@rebeccas

 I got this working on Combo box 1 and 2 but how do I get this working on combo box 3 (person field from sharepoint)?  I want it to, If IT Asset, default the people combo box to user John doe. Any thoughts on how to do this?

 

Thanks for your quick assistance!

 

Would you be able to say who...like put in their persons name?...if so it is the same concept but you just put their name in the quotes or do u need it t look up a person off the selection?

I want to put the IT directors name into the people field that is linked to a sharepoint people field, without the user's input. 

So, I think it would be this:

 

If(ComboBox1.Selected.Value="IT Asset", (Filter(Choices(SPListName.PeopleColumn),Value="John Doe")))

 

If that doesn't work let me know and I will click over and test it to see what needs to be different but I think it is right.

@rebeccas

 

Here is an image of my screen: When combox box 2 (1st level Approver) is set to It director I want to Approval Name field below to be set to "John Doe" and be grayed out.

 

 

I tried: 

If(DcdAssetTypeV.Selected.Value ="IT Asset",(Filter(Choices(CAPEX.'1stApprover'),Value="John Doe"))) 

This did not work and when I changed the column to the people column (Approval1 which is different from 1stApprover) the formula errors out.

 

 

2018-11-21 09_33_16-Window.png

Helpful resources

Announcements
PA 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 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.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

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

Top Solution Authors
Top Kudoed Authors
Users online (69,061)