I have two SharePoint lists: project request and project type. There is a lookup column in project request(name:project type) for project type that link to project type list ( name is title)
I have a dropdown in app that link to project type list. I used patch to send data via submit button to project request list.
This is the formula:
Patch(
'Project Request',
Defaults(Project Request),
{
'project type': drpProjectType.selected
}
but I have this error:
Invalid argument type.
Can you help me with that?
Thanks
Solved! Go to Solution.
Hi @RandyHayes
it is a single lookup
and picture shows the correct answer
I checked the list and it was added
You are really kind and Thanks for taking the time to solve my problem.
What is the Items property of your drpProjectType control?
Hi Randy,
This dropdown is connected to the project type list and the Item is the name of the list.
I have another dropdown with the same scenario and the Item property of that dropdown has Filter inside it.
Then if you are trying to create a new record, use the following:
Patch('Project Request',
Defaults(Project Request),
{
'project type': {Value: drpProjectType.Selected.Title, Id: drpProjecttype.Selected.ID}
}
)
Also can be done with:
Collect('Project Request',
{
'project type': {Value: drpProjectType.Selected.Title, Id: drpProjecttype.Selected.ID}
}
)
Couple of things:
1) Make sure you are supplying any required column values.
2) When you set a Lookup column in your list, you need to provide a record (assuming it is single selection column and not multiple). That record needs to have two columns, a Value column that is the linked value from the other list (default is Title, but verify in your SharePoint list lookup column definition) and you need to provide the ID of the record in the other list in the column Id. (Please note the difference in letter case...a record has an ID, a lookup column has a record that has an Id column)
You can also have the dropdown do the work for you...if the items property is the following:
ForAll(yourDataList,
{Value: Title,
Id: ID
}
)
Or even if a filtered list:
ForAll(Filter(yourDataList, <somecriteria>),
{Value: Title,
Id: ID
}
)
Then your original formula would work!
Patch('Project Request',
Defaults(Project Request),
{
'project type': drpProjectType.Selected
}
)
This is because you defined your Items of the dropdown to be a table with records with two columns...a Value column and an Id column - which is what the field wants in order to be updated. So, Selected will be that exact record schema.
Always a lot of ways to go about something, just depends on what fits the need best.
Hi,
I tried your first formula and assigned ID and Value but it didn't work. I changed the Item formula to Choices from the project request list and used the original formula and worked.
With the filter I have this formula:
Sort(Filter(Clients, Status.Value = "Active").Title,Title,Ascending)
I added ForAll function but gave me a syntax error. Can you tell me how to add it?
Thank you for your help
Choices will work because Choices is smart enough to know that when you do choices on a LookUp column, it will produce a table with records that have a Value and an Id in them automatically for you. Sometimes it is not desirable to use Choices and so the other formulas I provided would be better for those scenarios.
Tell me more about this formula you are talking about...is this one of the Items properties for a Lookup column dropdown? If so, you will not be able to use that formula that way as you are restricting it to a single column table with records that only have a Title column...you WILL need the ID column in order to use it.
So, if I am guessing what you might be talking about, then your formula should be:
ForAll(
Sort(Filter(Clients, Status.Value = "Active"), Title),
{Value: Title,
Id: ID
}
)
Thanks a lot, with your formula I understand the meaning.
Appreciate that
Just want to check with you this Filter when using ForAll:
Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value).'Full Name'
ForAll(
Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value)
{value: Full Name,
Id: ID
}
)
Everything is working as expected now?
Just want to check with you another Filter when using ForAll:
Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value).'Full Name'
ForAll(
Filter(Contacts, Trim(drpClients.SelectedText.Value) in Company.Value)
{value: Full Name,
Id: ID
}
)
This one give me invalid argument error
same for this filter as well:
Filter(Contacts, (Trim(drpClients.SelectedText.Value) in Company.Value) And (Bill_To.Value = "Yes")).'Full Name'
Sorry for the Inconvenience
User | Count |
---|---|
155 | |
98 | |
87 | |
78 | |
58 |
User | Count |
---|---|
189 | |
180 | |
107 | |
96 | |
91 |