cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
atagios
Frequent Visitor

Form combobox update a lookup field

Hi

I would appreciate if anyone can help with my following situation that has confused me:

We have a Screen with a form that we use for editing an existing or entering info of any new project (in the respective SharePoint list “projects”).

One of the information that we are entering in this screen with the new project form is a combo box “client” field. This field is a lookup field in another SharePoint list “clients”.

This way we have the necessary connection between our clients and their projects.

We want, when we are entering a new project info (in the screen with the new project form) to be able to also create a new client if the client does not exist in our clients list.

For that I have done :

1)In a Lookup in clients Sharepoiont Lost or in a collection of it, use the search text (of the client combo box) to see if the result IsBlank.

2) if it IsBlank make visible an add icon which will (OnSelect) patch the search text value to the SharePoint list of clients. And set the Patched new Client to a Variable.

OnSelect :” Set(VarNewClient, If(IsBlank(LookUp(ColClients, DataCardValue14.SearchText in ColClients.Customer)),Patch(Clients,Defaults(Clients), {Customer:DataCardValue14.SearchText})));”

My problem is now when the user completes all other info in this new project form and submits it, I want to store this new client value in the projects SharePoint list for this specific new project record.

Any ideas how this can be done?

2 REPLIES 2
SafaK
Helper I
Helper I

So, just to confirm, you have the main list called Projects and in this list you have a column named as Client which is linked to Clients table, to be able to patch into Projects table you need to use the below syntax :

Set(VarNewClient, If(IsBlank(LookUp(ColClients, DataCardValue14.SearchText in ColClients.Customer)),Patch(Clients,Defaults(Clients),
{Customer:
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

Id:DataCardValue14.selected.id,
Value:DataCardValue14.SearchText}
}) ));”


Where you need to define a Key and a value for this column.

atagios
Frequent Visitor

Hi SafaK,

Thank you for your response,

The Patch as I am using it is working fine, the Clients SharePoint list is updating fine with the Patch.

My actual problem is in updating the Projects SharePoint list when submitting the form with the selected Client of the combo box. I can’t figure out what should be the Update property of “DataCardValue14” which is the client combo box  

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,194)