cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Smitman34
New Member

How do I set a dropdown field value when a people picker changes?

I have a form connected to a SharePoint List, the input form is customized.  When a user edits the form the dropdown should reflect the value stored in the list.  When the user updates the people picker field the value of the dropdown should be reset to "In-Process"

 

I've tried everything from setting a global value:

OnChange of People picker = UpdateContext({varX:"changeIt"})

DefaultSelectedItem of DropDown = If(varX="changeIt",Filter(Choices('Access Request'.'Workflow Status'), Value="In-Process"), Parent.Default)

But that code is not working, it says there is an error in the If.

 

I've been starring at this for days and have tried many variations but I can't seem to figure it out.

Any help would be greatly appreciated.

 

Thanks, 

 

Mike-

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@Smitman34 

My understanding of your problem is you'd like the status show as in process when a people picker field has a value.  We accomplish this by reworking your code

 

Put this code in the the OnVisible property of your screen.

Set(personChanged,false);

 

Then put this code in the OnChanged property of the People Picker

Set(personChanged,true);

 

Finally use this code in the DefaultSelectedItems property of the ComboBox for status.  Make sure it is a ComboBox and not a Dropdown.

If(
    personChanged=true,
    LookUp(Choices('Access Request'.'Workflow Status'),Value="In-Process"),
    ThisItem.'Workflow Status'
)

 

I've tested this code so it should work.  Let me know.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
mdevaney
Super User III
Super User III

@Smitman34 

My understanding of your problem is you'd like the status show as in process when a people picker field has a value.  We accomplish this by reworking your code

 

Put this code in the the OnVisible property of your screen.

Set(personChanged,false);

 

Then put this code in the OnChanged property of the People Picker

Set(personChanged,true);

 

Finally use this code in the DefaultSelectedItems property of the ComboBox for status.  Make sure it is a ComboBox and not a Dropdown.

If(
    personChanged=true,
    LookUp(Choices('Access Request'.'Workflow Status'),Value="In-Process"),
    ThisItem.'Workflow Status'
)

 

I've tested this code so it should work.  Let me know.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Hello @mdevaney ,

Thank you for the assist.

The personChanged value seems to hang on after the form is edited and saved.

When I open the form again to edit, the value is switched to "In-Process".

As you can see in the background of this screen shot, the Level 1 has not changed but the workflow status has, and I have not taken any action on the form. 

I improved your solution by adding Set(personChanged,false) to the OnChange of the Combobox.

 

Thanks,

 

Mike-

 

@Smitman34 

If the issue is resolved please Accept as Solution and close the thread.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,946)