web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup a record by ID
Power Apps
Answered

Lookup a record by ID

(0) ShareShare
ReportReport
Posted on by 8

Hi All,

Have a relatively simple one that seems to be harder than I think it should be:

 

I've got a canvas app that accepts a "SurveyInstance" parameter, which I expect to match the unique identifier for my SurveyInstance CDS entity:

tiddlyplatypus_0-1634332189759.png

The general idea here is that I'd like to tie the survey instance to a specific employee and a specific survey.  If the survey instance is not provided, I want to take the current user, and through a few lookups, find their existing record.  I've run into the limitation on traversing multiple levels of many to one relationships several times in this effort, so I've created some intermediate variables to store values as I go through the lookup process.  I'm able to get to the point where I have the GUID returned and stored in varSurveyInstanceID, however, next I'd like to create a variable containing that record so I can avoid having multiple nested lookups throughout the application.

 

I've tried a few approaches that seemed to work in other areas of the application, but for whatever reason in my OnStart rule I cannot lookup the record by ID:

 

Set(varSurveyInstance,

     Lookup(SurveyInstances, SurveyInstance = varSurveyInstanceID));

 

Gives an error on comparing a record to a GUID

 

Set(varSurveyInstance,

     Lookup(SurveyInstances, SurveyInstance.SurveyInstance = varSurveyInstanceID));

 

Gives an error on invalid use of the '.' operator

 

Set(varSurveyInstance,

     Lookup(SurveyInstances, crad7_surveyinstanceid = varSurveyInstanceID));

 

Gives an error stating it's unable to find the column crad7_surveyinstanceid

 

Having a bit of a struggle believing looking up a record based on it's ID value is so difficult, is there perhaps something I missed in my table setup or in the syntax here?

 

 

 

 

 

 



I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @tiddlyplatypus ,

     

    Since I'm not aware of the structure of that Survey Instance table, I would use Accounts the default table as the example:

    in Canvas App:

    vjefferni_0-1634543943298.png

     

    the Account table in Dataverse and the column:

    vjefferni_1-1634543963418.png

     

    So, I think the first formula in your post is basically correct, except for varSurvey InstanceID variable may be a record. Therefore, you need to have a check in previous variable creation and make sure it is GUID.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard