cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
imranamikhan Helper I
Helper I

Update Text Field with Dropdown Control Selection

Hello,

 

I am quite new to Power Apps so apologies in advance for misunderstanding some basics.

 

I customised a SharePoint list form using Power Apps. In the SharePoint list I have a text field called “Power User Name”. I have a dropdown control outside of the form which contains a list of power user names. When a power user is selected from the dropdown control, I want the Power User Name text field updated. So when a user clicks Save using the default Save button on the SharePoint form, the SharePoint list for that field will be updated.

 

I understand I can use a patch function, and I have added this to the dropdown control via an OnSelect event. Formula below:

 

Patch('Fusion Data Validation Database & Form', {ID: SharePointIntegration.SelectedListItemID},{PowerUserName: 'Select Power User Dropdown'.Selected.Result})

 

Example.PNG

 

This works but not as expected. I have to select the field from the dropdown menu multiple times (usually 3 times, I cannot quite understand the pattern) before the Power User Name text field is updated with the selected dropdown value.

 

On perusing the forums, I understand I also need to look into Edit.Mode but not sure if this is relevant to this specific question.

 

I hope someone could help.

 

Best regards,

1 ACCEPTED SOLUTION

Accepted Solutions
imranamikhan Helper I
Helper I

Re: Update SharePoint Text Field with Dropdown Control Selection

After an exhausting number of hours I believe I managed to resolve this problem myself. In case anyone is having a similar problem in future I have outlined the steps I undertook in order to resolve this.

 

Context: I have a SharePoint list. I want to customise the default SharePoint form using Power Apps. The SharePoint list has a name column. I want to create a custom dropdown control which contains a list of user names which I want to use to update the name column in the SharePoint list.

 

What I did:

• Created a dropdown control card and populate it with names

• Set the Default for the control card to

 

If(SharePointForm1.Mode=FormMode.Edit,SharePointIntegration.Selected.'Name',"-")

* (“-“ is the default if a new form is launched)

 

• Bring the Name field (the one from SharePoint) into the form

• Unlock the card

• Set the Default from “Parent.Default” to

 

If(SharePointForm1.Mode=FormMode.Edit,Parent.Default,'Select Name Dropdown'.SelectedText.Result)

• Hide the card

 

I have no idea if this is the sensible approach but this is functioning. A drawback is if in the rare instance someone launches an existing record and edits the name from the dropdown control, the record will not be updated.

View solution in original post

3 REPLIES 3
imranamikhan Helper I
Helper I

Re: Update SharePoint Text Field with Dropdown Control Selection

I seemed to have resolved part of the problem by updating the Default setting for the Sharepoint data field ("Power User Name") with the following:

If(FormMode.Edit = FormMode.New,Parent.Default,'Select Power User Dropdown'.SelectedText.Result)

I have also removed the patch formula from the OnSelect event and returned it back to its default value (false). Now whenever I create a new item in the SharePoint list, the formula correctly updates the Sharepoint data field with whatever value is selected from the dropdown control.

 

However, when I edit an existing item, the fields on the power apps form do not reflect what was has been previously entered, it just displays the default value set by the dropdown control.

 

I am guessing the problem has to do with the default form mode (edit, new, view) but I do not know how to progress further.

 

Any assistance would be greatly appreciated.

 

Best regards,

imranamikhan Helper I
Helper I

Re: Update SharePoint Text Field with Dropdown Control Selection

After an exhausting number of hours I believe I managed to resolve this problem myself. In case anyone is having a similar problem in future I have outlined the steps I undertook in order to resolve this.

 

Context: I have a SharePoint list. I want to customise the default SharePoint form using Power Apps. The SharePoint list has a name column. I want to create a custom dropdown control which contains a list of user names which I want to use to update the name column in the SharePoint list.

 

What I did:

• Created a dropdown control card and populate it with names

• Set the Default for the control card to

 

If(SharePointForm1.Mode=FormMode.Edit,SharePointIntegration.Selected.'Name',"-")

* (“-“ is the default if a new form is launched)

 

• Bring the Name field (the one from SharePoint) into the form

• Unlock the card

• Set the Default from “Parent.Default” to

 

If(SharePointForm1.Mode=FormMode.Edit,Parent.Default,'Select Name Dropdown'.SelectedText.Result)

• Hide the card

 

I have no idea if this is the sensible approach but this is functioning. A drawback is if in the rare instance someone launches an existing record and edits the name from the dropdown control, the record will not be updated.

View solution in original post

IvanGS
Frequent Visitor

Re: Update SharePoint Text Field with Dropdown Control Selection

thank you so much for coming back and adding this info, my issue was not exactly the same but it gave me the framework to get what I wanted to work..  Had some calculated forms but the drop downs were then not saving the data back in the form.. I had the data live copied into another (non visible)  text box that wrote the data to the form on save.

Not elegant but it worked.

Cheers !

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,634)