cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
brijesh
Frequent Visitor

How to initialize component's custom property of type "Record"

Hi, I have created a custom property of type "Record" in a component and trying to initialize it "OnVisible" action of a screen but it says "Invalid argument type".

brijesh_0-1608548705366.png

But as you can see in below images, data type is "Record" of both i.e. component's custom property and the value that is being assigned.

brijesh_1-1608548753905.pngbrijesh_2-1608548765695.png

Can someone please help me know where I am wrong and what is the correct way of initializing customer property of type Record.

 

Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@brijesh 

Yes exactly, so just move the formula from the OnVisible action to the Assessment property of the Custom Component you have on that screen.

You do have the component on the screen (I am sure at this point) and I assume component is named cmpBreadcrumbMenu_1 

So, on the Assessment property of cmpBreadcrumbMenu_1 to:

    LookUp(Assessments, 'Assessment (...sessmentid)' = GUID("0087fc6c-2128-eb11-a813-000d3a7f59a6"))

 

(note: fix the part in red above as it was not clear in your picture example)

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@brijesh 

You cannot assign values to properties like that in PowerApps.

You would need to move that formula to the Assessment property of the component on the screen.

And you should consider using a LookUp rather than a First(Filter as this method will filter all of the matching records (iterating through all of them) and then taking the First record.  LookUp will start iterating and stop at the first record it finds.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks Randy for the suggestion of using Lookup instead of Filter. I didn't know about that.

"You would need to move that formula to the Assessment property of the component on the screen." - Sorry I could not understand what do you mean by this. I am doing this on screen itself where I have placed the component.

 

Thanks

RandyHayes
Super User
Super User

@brijesh 

Yes exactly, so just move the formula from the OnVisible action to the Assessment property of the Custom Component you have on that screen.

You do have the component on the screen (I am sure at this point) and I assume component is named cmpBreadcrumbMenu_1 

So, on the Assessment property of cmpBreadcrumbMenu_1 to:

    LookUp(Assessments, 'Assessment (...sessmentid)' = GUID("0087fc6c-2128-eb11-a813-000d3a7f59a6"))

 

(note: fix the part in red above as it was not clear in your picture example)

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks Randy. It worked for me.

 

Thanks

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,607)