cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
testasdfasfsafa
Advocate III
Advocate III

Cannot set default lookup value on a CDS field

I have a CDS data source (dynamics 365) powering an Edit form.  The edit form is set to "new" form so a user can fill-in the form.  I have some lookup fields and that needs to be set to a default value.  Normally, I simply type the value text like "UPS" or "FEDEX" and it works fine.  But using CDS as the source, PowerApps keeps return error. I search everywhere, but can only find sharepoint example with ODATA.

 

I tried to type the actually GUID "1f865925-843c-e911-a971-000d3a34a14b" of lookup time and even type the text value "UPS" , no luck 😞  

 

I'd appreciate if anyone could share how they were able to setup default values coming from CDS.  Thanks.,

 

GUID.pngDefault Text based value.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

@testasdfasfsafa ,

 

No worries! 🙂

I checked here, and you can use:

DefaultSelectedItems --> First(Filter(Carrier, new_name = "UPS")) 

 

2 changes:

- Default to DefaultSelectedItems

- "new_name" to new_name

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Renato Romão
https://www.linkedin.com/in/renatoromao/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+2.650 students) : English | Português

View solution in original post

7 REPLIES 7
renatoromao
Super User
Super User

Hi @testasdfasfsafa ,

 

This property needs to insert the Record value. We can use this sample below:

 

Default --> First(Filter(YourCARRIEREntity, "new_name" = "UFS"))

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Renato Romão
https://www.linkedin.com/in/renatoromao/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+2.650 students) : English | Português

Thank you so much for the expert advice!!  Your suggestion seems to make perfect sense.  There is no error anymore :), but the default value doesn't show up when I run the app...  Any thoughts?

 

New formula.png

Are there any options when you open the Carrier dropdown?

If yes, can you check if it has the "UPS" value?

If yes, can you check if it shows the "new_name" column?

If yes, try to change the code to First(Choices(@[...].new_Carrier)) instead of First(Filter(...))

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Renato Romão
https://www.linkedin.com/in/renatoromao/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+2.650 students) : English | Português

First of all, let me express my gratitude for your guidance with this challenging topic...

 

You said..

Are there any options when you open the Carrier dropdown?  YES

If yes, can you check if it has the "UPS" value? YES

If yes, can you check if it shows the "new_name" column?  (not sure where to look for that question)

If yes, try to change the code to First(Choices(@[...].new_Carrier)) instead of First(Filter(...))  I tried, but I'm afraid I have a syntax issue.

 

I'm sorry, I'm not a true developer but a poweruser... Here's what I have now... I feel it's like 99% there...

 

 

@testasdfasfsafa ,

 

No worries! 🙂

I checked here, and you can use:

DefaultSelectedItems --> First(Filter(Carrier, new_name = "UPS")) 

 

2 changes:

- Default to DefaultSelectedItems

- "new_name" to new_name

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Renato Romão
https://www.linkedin.com/in/renatoromao/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+2.650 students) : English | Português

View solution in original post

Wow, that was it!! It works just fine now 🙂

 

I wish I can send more then Kudos!!  (and wish Microsoft would spend more time documenting their tools).

 

BTW, does the filter approach would also work for choice columns (instead of lookups)?

Hi @testasdfasfsafa ,

 

Nice! 😄

 

No, we just use "UPS" if it is a choice column. 


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+2.650 students) : English | Português

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

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,837)