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

 

 

16 REPLIES 16

@rebeccas

 

I got rid of the error message by updating the forumula to:

 

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

 

but it did not input the name into the field. The field is staying blank.

You have to put something in there to tell it DisplayName I think...Let me play around with it a minute and I will get back with you.

Yeah...change it to this:

 

If(DcdAssetTypeV.Selected.Value ="IT Asset",{DisplayName:"JohnDoe"})

@arichards

 

I am sure that should show the correct name but test it and make sure when you submit that it actually stores that field.

 

If it doesn't you may have to put a similar if statement on the Update Value for the card that holds that combo box. I can't remember if it needs both or just one.

 

 

 

 

@rebeccas

 

The formula works to put the name there but it is not saving the name. Upon save the field is blank.  I have put the code on both the DefaultSelected Items and the data cards update but the value is not getting saved to the list.

@arichards

 

Okay...the update part is a little more tricky...I don't remember having to do all this before but seems you do. You have to tell it all the fields for the update so:

 

If(DcdAssetTypeV.Selected.Value="IT Asset",
{DisplayName:"John Doe",
Claims:"i:0#.f|membership|" & Lower("johndoe@gmail.com"),
Department:"",
Email:"johndoe@gmail.com",
JobTitle:"",
Picture:""},DataCardValue8.Selected)

 

 

** DataCardValue8 being the combo box that is the people field so that if it isn't "IT Asset" it will put what they select.

 

@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

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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (52,027)