Hi all,
With the help from this thread (https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-patch-a-SharePoint-Lookup-Column/td-p/24094) I have used the following patch() function in the ONCHANGE propert of the combobox2:
Patch('Project Costs Consultants Weekly Work',
ThisItem,
{Consultant:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:ProjectCostsGallery.Selected.ID,
Value:ComboBox2.Selected.'Name ({Name})'}
}
)
However, it seems that it does not work. Whenever I choose a name from the Combobox2 (which is connected to an employeelist) it does not patch the name into the "Consultant"-column. Ideally, what I would like to happen is to choose a name, the "Consultant" tab changes to that name AND it drags the corresponding "Daily Price" and "Daily Cost" from that employee:
The "Consultant" column is a LookUp column, which has many different columns dragged into this List among which are the "Daily Cost" and "Daily Price".
Is this possible?
Hi @Anonymous ,
Based on the formula that you mentioned, I think there is something wrong with the value you provided for the Id property under the Consultant field.
The Id property under the Consultant field should be provided with ID value from your 'Employee List SPM' rather than your 'Project Costs Consultants Weekly Work' List.
Please consider modify your formula as below:
Patch(
'Project Costs Consultants Weekly Work',
ThisItem,
{
Consultant: {
Id: LookUp('Employee List SPM', Name = ComboBox2.Selected.Name, ID),
Value: ComboBox2.Selected.Name
}
}
)
Set the Items property of the ComboBox2 to following:
'Employee List SPM'.Name
Please take a try with above solution, then check if the issue is solved.
Best regards,
@WarrenBelz thanks for the tag, I'll give this tricky one a try.
@Anonymous
Can you try this
Patch('Project Costs Consultants Weekly Work',
ThisItem,
{Consultant:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:LookUp(lookupListName, 'Name ({Name})' = ComboBox2.Selected.'Name ({Name})',ID),
Value:ComboBox2.Selected.'Name ({Name})'}
}
)
Notes:
1. lookupListName is the SP List that the LookUp column is referencing
2. 'Name ({Name})' may not be 100% correct, it may just be 'Name'? Just play around with it to see what works.
Let me know how you get on
HI @Anonymous ,
I will tag another colleague @Anonymous to see if he has any ideas.
Bumping and crossing fingers someone can help with this problem. Still no luck unfortunately 😞
@CarlosFigueirawould you have a chance to take a look at this?
@WarrenBelzHave a good night and thank you for the effort!
Crossing fingers @mdevaney has the time to help 🙂
Thanks @Anonymous ,
I will do what I always do when something works for me and not for you - call in one of my code guru colleagues @mdevaney - my time zone will take me offline shortly (late night here) - he will just be having breakfast.
Sorry, no luck. I just changed the column to "Employee" and nothing has changed. I get an error when I change the Items Property to:
Choices([@'Employee List SPM'].Employee) /Choices([@'Employee List SPM'].Name)/Choices([@'Employee List SPM'].etc)
Ok @Anonymous ,
That may be the reason for the no result - you should not use "reserved" words like Name as anything (field, list, control or variable) as it becomes ambiguous to PowerApps and it may initiate something completely different from what you intend.
However the Items of the ComboBox should be something like
Choices([@'Employee List SPM'].Name)
@WarrenBelz, I agree, in hindsight this should be more generic.
The items property is basically: 'Employee List SPM'.Name
I am essentially intending to choose one of the employees from our list
OK @Anonymous ,
Nothing unusual there except Name is a very bad name for a field - what is the Items property of ComboBox2?
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2