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 / How to access ThisReco...
Power Apps
Unanswered

How to access ThisRecord Dynamically ex ThisRecord.variable (variable is subjected to change and will be definitely available in ThisRecord) in canvas app

(0) ShareShare
ReportReport
Posted on by 4

Below is the code which i need to modify to make it dynamic, such that if User selects "Teams" table, then "Teams" associated primaryKey(variable), createdon, createdby, modifiedon and modifiedBy column data should be accessed and stored in tempTable. (Assume that all the mentioned columns are available in both/all tables)

 

 

If(Self.Selected.Value="Teams",Set(entityName,Teams),Set(entityName,Contacts));
ForAll(
entityName,
Collect(
tempTable,
{
name: ThisRecord.name,
createdOn: ThisRecord.createdon,
creatdBy: ThisRecord.createdby,
modifiedOn: ThisRecord.modifiedon,
modifiedBy : ThisRecord.modifiedby
}
)
);

 

 

 

Categories:
  • WarrenBelz Profile Picture
    156,763 Most Valuable Professional on at

    Hi @harshakurakula ,

    You cannot refer to data sources or field names (among other things) dynamically in Power Apps - you need to hard-code it.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • harshakurakula Profile Picture
    4 on at

    Thanks @WarrenBelz for your quick response

  • mmollet Profile Picture
    3,187 on at

    Although it would be ugly and loooong code you could do this with a switch statement I think. 

    Switch(UserSelection,

    "Teams",

    ForAll(entityName, Collect(tempTable,
    {
    name: ThisRecord.name,
    createdOn: ThisRecord.createdon,
    creatdBy: ThisRecord.createdby,
    modifiedOn: ThisRecord.modifiedon,
    modifiedBy : ThisRecord.modifiedby
    }));,

    "OtherOption",

    ForAllPatchForThisOption,

    "OptionThree",

    ForAllPatchForThisOption

    )

     

    The switch can invoke whatever data source you need based on the user input and then since the columns will match you can just throw them all in the same collection for each case in the switch statement. Not 100% sure this will work for you situation but all I can come up with off the top of my head.

  • harshakurakula Profile Picture
    4 on at

    Thanks @mmollet for your response. i will try this 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard