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.300 students | PROMOTIONS) : 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.300 students | PROMOTIONS) : 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.300 students | PROMOTIONS) : 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.300 students | PROMOTIONS) : 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.300 students | PROMOTIONS) : 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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (60,627)