Microsoft Powerapps - How to connect to different datasource in one form - sharepoint

I'm building an app for TravelInfo. Here are the fields: From, To, City, Country.
I am using common data source entity. And for the country lookup, I want to use a sharepoint list, that has all the country names.
I'm stuck at this stage. As you see in the snap, I want to connect the country dropdown to a sharepoint list.
[I've tried to achieve the same with picklist. But Its not good to manually create the huge list of countries in picklist. Sharepoint list should be ideal.]
Here is the question: In one form, how can I use different datasource for different fields??? Please help.

A form will save the data card value defined in Update into the field defined by DataField. You are trying to change data displayed on the dropdown which is not set in the Fields list you have above. Try the following (the first few steps may already be completed based on picture):
Check Country to insert data card into form
Select data card and under Advanced properties click Unlock to change properties
Delete text box from data card that was added by default
Select data card and insert desired control (drop down box)
Select drop down box (not data card) and under Advanced properties define Items and Value to populate values from the sharepoint list
Select data card and change Update to desired dropdown value that should be saved e.g. dropDown1.Selected.country_id
The drop down box can display the Country text on the form, but then save an associated value such as the country id.

Related

How do I use a power apps form for a lookup column?

I have a SharePoint List (say "List-A") with plenty of columns, some of which are lookup columns.
These are just used to construct a choice columns, where the items in the choice drop down are the items of a column in a different List ("List-B").
I have used the function on SharePoint to integrate List-A with Power Apps Form. This creates a Power Apps form that is readily available.
For the Lookup choice columns, I have added List-B as the data source, and am using the items from the correct column as items in the choice that is linked to the lookup column. This correctly populates the drop down menu as expected.
Now when I publish this form and fill it from sharepoint (it pops up as it should hafter clicking New in the List view) I can fill the entire form and submit with no issue. However all the lookup columns remain blank, as if the form returned a null value instead of the selected.
I have both datasources set up:
The update property of the datacard connecting to the SharePoint List is equal to the Selected of the datacard containing the combobox (combobox is called DataCardValue43).
The items property of the combobox is equal to the correct column of List-B.
As an alternative solution, I have attempted to make a different column that is just one line of text. For this column, I have made a combobox once again setting the items property to the column in List-B. The intention was to return the selected value as a string. It was attempted thus:
where combobox1 once again manages to give the correct options in the drop down box but returns only Null.
To study it further, I have made a power apps flow that takes Create New Sharepoint List object as input. Here I see that the values are indeed Null
The one called "Return" is the text column that I made, and the other being the lookup column. I do notice that the Lookup column isn't called Value, but id. I don't know what to do with that information though.
I really just want to have a column in my power apps form that lets you choose and the choices are values from a column in a different List. What do I do, and why doesn't what I've already done work?
Thank you.
Please follow the steps below to solve the issue.
1: Add a Lookup column in SharePoint List.
2: Open that list in Power Apps by using the Customise Forms Option From SharePoint.
3: The Item property of Lookup field will be by default as follow:
Choices([#'CustomisingSharePointList'].LookupColumnListName)
4: There is no need to change/delete the lookup field with any custom dropdown or combo box. This is the point, where you are doing mistake by adding a custom combobox and replacing the original Lookup dropdown. If you want to change datasource, apply filter or sort the data, you can do all these thing to the same original lookup column.
e.g I have applied filter and sort functions to the existing data:
Sort(Filter(Choices([#'CustomisingSharePointList'].'LookupColumnListName'), Value in Filter(LookupColumnListDataSoure,Progress.Value = "Open").ID),Id)
5: When you will publish the list, it will work fine.
Note:
CustomisingSharePointList: List in which we have added a lookup column.
LookupColumnListName: List to which the lookup column actually belongs to.
LookupColumnListDataSoure: You need to add the original list as data source in power apps to use the above filter. This step is optional and applicable only if you apply filter like I did in step 4

Sharepoint update field based on lookup

I have a Sharepoint online list "myList" with fields PersonName, OriginCountry and OriginCity and another list of countries and cities called "WorldList" with columns Country and City.
In myList the user will select their city using a lookup to Worldlist. I want the country field to update based on what is entered into the city field.
What's the best way to do this?
I would like to do this without a webPart, Powerapp or Flow, but will use them if necessary. I would prefer to use a Flow rather than a Powerapp or webpart.
When you set the OriginCity lookup column in myList from WorldList, please add an additional column country as shown below:
If you don’t want to show the additional column in list view, you can hide the column.
Then create a flow to update the OriginCountry value using the additional column "OriginCity:Country":
Simple test for your reference:
-------------------------Update----------------------------------
Note, exclude OriginCountry ID, other columns will use the property under "when you created or modified the item" option.

PowerApps form doesn't save external data to SharePoint list

I've created custom form with PowerApps so when you click on New button in SharePoint you will see this:
This form is for SharePoint list Workflow but for column CostCenter I'm using external list Companies and Cost Centers where I'm filtering values based on selected Company (Cascading Dropdown).
I'm able to select data in those two fields correctly but when I hit the Save button in the form the value of CostCenter is not saved to Workflow list but everything else is.
So Title, Property Manager, Company, etc. except CostCenter is saved. I guess it's connected to that Data Source of each field but I don't know how to send those data from CostCenter to Workflow too.
Thank you for your help.

Infopath: Include data for active form only is grayed out

Here's my workflow:
An item gets added in a Sharepoint List (Say x). At that moment, a workflow triggers and starts a data collection task. For this task there is an Infopath fom which needs to collect some data from the user
This form has some fields which are to be fetched from the corresponding Sharepoint list item in list X and displayed in the form
I am trying to setup a data connection with the list X and fetching the fields of my interest.
However, the option "Include data for active form only" while setting up the connection is grayed out.
I am not able to get the right results in the form from the data connection, the data is not being returned for the right SharepointList item. THe data being returned is for the first item in list X.
Thanks!
This is because you are not passing a filter into the data connection. You are querying the list without an ID and since you are not selecting a specific list item it is just returning data from the first list item every time.
You are going to need to select a unique identifier and filter your result by clicking the add filter button and setting the foreign key = to primary key in list x. A quick google search of add filter to data in info path should give you an idea of what I am describing.
You may need to add a column in your initial table that imports the key from list x as a foreign key in your initial list.

Dynamics CRM 2011: Extended lookup for a field in "Create New" form

I have the following scenario:
A user wants to create a new record of entity CustomEntity1. One of the fields on the "Create New" form is a reference to the entity of type CustomEntity2.
Now, there is a built in lookup where thety can search by name, or filter the options to a predefined view. This doesn't help, because the user needs to get the name (or names) of CustomEntity2 which satisfies a set of criteria based on the fields in CustomEntity2.
Is there a way to incorporate this in "Create New" form for CustomEntity1?
And the question again, a bit less abstract:
The user needs to create a new record of type CustomerAccount. In doing this he/she needs to fill a field called Group. This should be looked up in a list of existing groups, based on several criteria - Type, Region, Budget and so on. Is there a way for the user to enter this criteria while creating the new record, and not go separately to the list of Groups and run a report to find the candidates?
You can use the addCustomView method of the lookup control to filter the options based on the fetchXML and layoutXML that you provide.
One way to supply the right conditions to your custom fetchXML is to duplicate the Type, Region, and Budget fields in the CustomerAccount form, so that when the lookup dialog is opened, it filters the existing Groups based on the values you've selected in the CustomerAccount form.

Resources