cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mattw112IG
Impactful Individual
Impactful Individual

How to Set a default option when using SharePoint Lookup

I have a SharePoint list and one column is a lookup.

I have a PowerApp build stand alone (not integrated in SharePoint).

The lookup field works fine, but I would like to set a default option.

I have been able to get the words that I want to show up as the default selected item, but on Submit doesn't populate the SP List.

From reaching looks like I need ID and Value.  Have read several articles:

https://sympmarc.com/2018/02/05/powerapps-setting-a-sharepoint-list-lookup-column/

https://docs.microsoft.com/en-us/microsoft-365/community/working-with-cascading-lists-in-sharepoint-...

https://powerusers.microsoft.com/t5/Building-Power-Apps/PowerApps-and-SharePoint-Lookup-Columns/m-p/...

https://techdailychronicle.com/handling-sharepoint-lookup-and-people-fields-in-powerapps/

https://www.c-sharpcorner.com/article/set-a-default-value-of-the-look-up-column-in-powerapps-new-for...

 

But I'm still not getting it to work?

 

On the combobox I am trying this for the default and defaultselecteditems

{
'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: LookUp('Titles and Roles',Title = Office365Users.MyProfileV2().jobTitle,ID),
Value: Office365Users.MyProfileV2().jobTitle
}
 
On the card for update I have tried:
DataCardValue2.Selected
 
And 
{
'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: LookUp('Titles and Roles',Title = Office365Users.MyProfileV2().jobTitle,ID),
Value: Office365Users.MyProfileV2().jobTitle
}
 
But neither worked.  No errors, just doesn't add to the list.
 
I dont want to do a patch because I have a flow that runs on create.  So if I did a patch after the create, not sure it would pick it up?
 
Thanks,
Terry
 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

The delegation warning is because of the Office365Users() call being used in the Lookup. You could put that value from the Office365Users() call in a variable then use the variable in the Lookup and that would resolve the delegation warning. However, if you are under the delegation limit in the 'Titles and Roles' list then you should get a result back even with the delegation warning. Did you verify that the value being returned from Office365Users.MyProfileV2().jobTitle exactly matches a Title of an item in 'Titles and Roles' list?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Jeff_Thorpe
Super User
Super User

Did you verify that the Lookup() is returning the ID as expected? 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Mattw112IG
Impactful Individual
Impactful Individual

I just put it in a Label and it doesn't return anything... not sure what is wrong with it though?  No errors in the console (just a delegation warning), but I won't ever have 2000 items in the list, maybe 60 at most.

The delegation warning is because of the Office365Users() call being used in the Lookup. You could put that value from the Office365Users() call in a variable then use the variable in the Lookup and that would resolve the delegation warning. However, if you are under the delegation limit in the 'Titles and Roles' list then you should get a result back even with the delegation warning. Did you verify that the value being returned from Office365Users.MyProfileV2().jobTitle exactly matches a Title of an item in 'Titles and Roles' list?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Mattw112IG
Impactful Individual
Impactful Individual

Geesh.. you are right.. lol  "and" vs "&".

 

Thanks,

Terry

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,416)