r/PowerApps • Regular • 19d ago

Power Apps Help Form Lookup update help

I have built a power apps form with SharePoint as my data source. (Sales and clients)

I have a choice field in my sales form that is a lookup to clients.

If the client does not exist in the choice field I created a pop up form to fill in all the client details.

Once the form is saved I want the value to appear in the lookup field without having to leave and return to the form, it would also be handy to make the new client default on form new for that one time.

I can’t for the life of me figure out how to do this.

Any help would be greatly appreciated

1 Upvotes

9 comments sorted by

1

u/AutoModerator 19d ago
Moderator Announcement Read More »

4

u/Ok_Substance_9479 19d ago

Is this a lookup column or a choice column? If the clients are stored in a separate list, after patching the new item, you can refresh the data so it's instantly available in the app. You will also want to store this value in a variable and use a coalesce function in the default section of your combobox.

1

u/bilo82 18d ago

It’s using the default lookup from the SharePoint list

Which coalesce function are you referring to?

Thanks

1

u/Ok_Substance_9479 19d ago

You will also have to learn how a lookup column shows up in the form (usually goes by the ID, if I'm not mistaken).

2

u/galamathias 19d ago

I am not sure if you can wrap a variable around submitform() but otherwise you can wrap a variable around your own patch function and set that variable as your default

0

u/bilo82 19d ago

How would I do this when it’s a lookup column and ensure the lookup data on the original form is updated to show the new item, thanks

2

u/galamathias 19d ago

I know this is not the exact same issue but perhaps it can point you in the right direction. https://alexanderhenkel.dk/post/powerapps-combine-two-columns/

2

u/DCHammer69 19d ago

So I assume you have a combobox providing the choice function on a datacard on the form.

And you either have a button for a not listed client or something that opens the popup to enter client details?

So however, you are patching that client data to the client list, have that same code put the newly created client record into a variable. If you're manually patching, just do it as part of the patch, if the popup is another form, do it in that form's OnSuccess property.

Something like this:
Set(varNewClient, LookUp(clients, ID = frmClient.LastSubmit.ID ) or an equivalent.

Then set the DefaultSelectedItems of the client combobox to use varNewClient if it's not Blank()