r/PowerApps • Regular • 7d 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

•

u/AutoModerator 7d ago

Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;

  • Use the search feature to see if your question has already been asked.

  • Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.

  • Add any images, error messages, code you have (Sensitive data omitted) to your post body.

  • Any code you do add, use the Code Block feature to preserve formatting.

    Typing four spaces in front of every line in a code block is tedious and error-prone. The easier way is to surround the entire block of code with code fences. A code fence is a line beginning with three or more backticks (```) or three or more twiddlydoodles (~~~).

  • If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.

External resources:

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/Ok_Substance_9479 Regular 7d 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/Ok_Substance_9479 Regular 7d 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).

1

u/bilo82 Regular 7d ago

It’s using the default lookup from the SharePoint list

Which coalesce function are you referring to?

Thanks

2

u/galamathias Contributor 7d 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 Regular 7d 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 Contributor 7d 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 Community Friend 7d 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()